System.ComponentModel.TypeDescriptor Class

Provides information about the characteristics for a component, such as its attributes, properties, and events. This class cannot be inherited.

See Also: TypeDescriptor Members


public sealed class TypeDescriptor


The .NET Framework provides two ways to access metadata on a type: the reflection API provided in the System.Reflection namespace, and the System.ComponentModel.TypeDescriptor class. Reflection is a general mechanism available to all types because its foundation is established in the object.GetType method of the root object class. The information it returns for a type is not extensible, in that it cannot be modified after compilation of the target type. For more information, see the topics in Reflection.

In contrast, System.ComponentModel.TypeDescriptor is an extensible inspection mechanism for components: those classes that implement the System.ComponentModel.IComponent interface. Unlike reflection, it does not inspect for methods. System.ComponentModel.TypeDescriptor can be dynamically extended by several services available through the target component's Component.Site. The following table shows these services.


Enables another class, such as System.Windows.Forms.ToolTip, to provide extra properties to a component.


Enables another object to modify the standard metadata that is exposed by a component.


Enables a class to completely and dynamically specify its own metadata, replacing the standard inspection mechanism of System.ComponentModel.TypeDescriptor.

The extensibility provided by System.ComponentModel.TypeDescriptor allows the design-time representation of a component to differ from its actual run-time representation, which makes System.ComponentModel.TypeDescriptor useful for building design-time infrastructure.

All the methods in System.ComponentModel.TypeDescriptor are static. You cannot create an instance of this class, and this class cannot be inherited.

You can set property and event values two different ways: specify them in the component class or change them at design time. Because you can set these values two ways, the overloaded methods of System.ComponentModel.TypeDescriptor take two different types of parameters: a class type or an object instance.

When you want to access System.ComponentModel.TypeDescriptor information and you have an instance of the object, use the method that calls for a component. Use the method that calls for the class type only when you do not have an instance of the object.

Properties and events are cached by System.ComponentModel.TypeDescriptor for speed. Typically, they are constant for the lifetime of an object. However, extender providers and designers can change the set of properties on an object. If this is the case, then the erload:System.ComponentModel.TypeDescriptor.Refresh method must be called to update the cache.


Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,