Skip to main content
TypeDescriptor Class
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

SystemObject
  System.ComponentModelTypeDescriptor

[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)]
public sealed class TypeDescriptor
[HostProtectionAttribute(SecurityAction::LinkDemand, SharedState = true)]
public ref class TypeDescriptor sealed 
[<Sealed>]
[<HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)>]
type TypeDescriptor = class end
<HostProtectionAttribute(SecurityAction.LinkDemand, SharedState := True)>
Public NotInheritable Class TypeDescriptor
NameDescription
System_CAPS_pubproperty System_CAPS_static

Obsolete. This API supports the product infrastructure and is not intended to be used directly from your code. Gets or sets the provider for the Component Object Model (COM) type information for the target component.

System_CAPS_pubproperty System_CAPS_static

Gets the type of the Component Object Model (COM) object represented by the target component.

System_CAPS_pubproperty System_CAPS_static

Gets a type that represents a type description provider for all interface types.

NameDescription
System_CAPS_pubmethod System_CAPS_static AddAttributes

Adds class-level attributes to the target component instance.

System_CAPS_pubmethod System_CAPS_static AddAttributes

Adds class-level attributes to the target component type.

System_CAPS_pubmethod System_CAPS_static AddEditorTable

Adds an editor table for the given editor base type.

System_CAPS_pubmethod System_CAPS_static AddProvider

Adds a type description provider for a single instance of a component.

System_CAPS_pubmethod System_CAPS_static AddProvider

Adds a type description provider for a component class.

System_CAPS_pubmethod System_CAPS_static AddProviderTransparent

Adds a type description provider for a single instance of a component.

System_CAPS_pubmethod System_CAPS_static AddProviderTransparent

Adds a type description provider for a component class.

System_CAPS_pubmethod System_CAPS_static CreateAssociation

Creates a primary-secondary association between two objects.

System_CAPS_pubmethod System_CAPS_static CreateDesigner

Creates an instance of the designer associated with the specified component and of the specified type of designer.

System_CAPS_pubmethod System_CAPS_static CreateEvent

Creates a new event descriptor that is identical to an existing event descriptor, when passed the existing EventDescriptor.

System_CAPS_pubmethod System_CAPS_static CreateEvent

Creates a new event descriptor that is identical to an existing event descriptor by dynamically generating descriptor information from a specified event on a type.

System_CAPS_pubmethod System_CAPS_static CreateInstance

Creates an object that can substitute for another data type.

System_CAPS_pubmethod System_CAPS_static CreateProperty

Creates a new property descriptor from an existing property descriptor, using the specified existing PropertyDescriptor and attribute array.

System_CAPS_pubmethod System_CAPS_static CreateProperty

Creates and dynamically binds a property descriptor to a type, using the specified property name, type, and attribute array.

System_CAPS_pubmethod Equals

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethod System_CAPS_static GetAssociation

Returns an instance of the type associated with the specified primary object.

System_CAPS_pubmethod System_CAPS_static GetAttributes

Returns the collection of attributes for the specified component.

System_CAPS_pubmethod System_CAPS_static GetAttributes

Returns a collection of attributes for the specified component and a Boolean indicating that a custom type descriptor has been created.

System_CAPS_pubmethod System_CAPS_static GetAttributes

Returns a collection of attributes for the specified type of component.

System_CAPS_pubmethod System_CAPS_static GetClassName

Returns the name of the class for the specified component using the default type descriptor.

System_CAPS_pubmethod System_CAPS_static GetClassName

Returns the name of the class for the specified component using a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetClassName

Returns the name of the class for the specified type.

System_CAPS_pubmethod System_CAPS_static GetComponentName

Returns the name of the specified component using the default type descriptor.

System_CAPS_pubmethod System_CAPS_static GetComponentName

Returns the name of the specified component using a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetConverter

Returns a type converter for the type of the specified component.

System_CAPS_pubmethod System_CAPS_static GetConverter

Returns a type converter for the type of the specified component with a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetConverter

Returns a type converter for the specified type.

System_CAPS_pubmethod System_CAPS_static GetDefaultEvent

Returns the default event for the specified component.

System_CAPS_pubmethod System_CAPS_static GetDefaultEvent

Returns the default event for a component with a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetDefaultEvent

Returns the default event for the specified type of component.

System_CAPS_pubmethod System_CAPS_static GetDefaultProperty

Returns the default property for the specified component.

System_CAPS_pubmethod System_CAPS_static GetDefaultProperty

Returns the default property for the specified component with a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetDefaultProperty

Returns the default property for the specified type of component.

System_CAPS_pubmethod System_CAPS_static GetEditor

Gets an editor with the specified base type for the specified component.

System_CAPS_pubmethod System_CAPS_static GetEditor

Returns an editor with the specified base type and with a custom type descriptor for the specified component.

System_CAPS_pubmethod System_CAPS_static GetEditor

Returns an editor with the specified base type for the specified type.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for the specified component.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for a specified component using a specified array of attributes as a filter.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for a specified component using a specified array of attributes as a filter and using a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for a specified component with a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for a specified type of component.

System_CAPS_pubmethod System_CAPS_static GetEvents

Returns the collection of events for a specified type of component using a specified array of attributes as a filter.

System_CAPS_pubmethod System_CAPS_static GetFullComponentName

Returns the fully qualified name of the component.

System_CAPS_pubmethod GetHashCode

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified component.

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified component using a specified array of attributes as a filter.

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified component using a specified array of attributes as a filter and using a custom type descriptor.

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified component using the default type descriptor.

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified type of component.

System_CAPS_pubmethod System_CAPS_static GetProperties

Returns the collection of properties for a specified type of component using a specified array of attributes as a filter.

System_CAPS_pubmethod System_CAPS_static GetProvider

Returns the type description provider for the specified component.

System_CAPS_pubmethod System_CAPS_static GetProvider

Returns the type description provider for the specified type.

System_CAPS_pubmethod System_CAPS_static GetReflectionType

Returns a Type that can be used to perform reflection, given an object.

System_CAPS_pubmethod System_CAPS_static GetReflectionType

Returns a Type that can be used to perform reflection, given a class type.

System_CAPS_pubmethod GetType

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod System_CAPS_static Refresh

Clears the properties and events for the specified assembly from the cache.

System_CAPS_pubmethod System_CAPS_static Refresh

Clears the properties and events for the specified module from the cache.

System_CAPS_pubmethod System_CAPS_static Refresh

Clears the properties and events for the specified component from the cache.

System_CAPS_pubmethod System_CAPS_static Refresh

Clears the properties and events for the specified type of component from the cache.

System_CAPS_pubmethod System_CAPS_static RemoveAssociation

Removes an association between two objects.

System_CAPS_pubmethod System_CAPS_static RemoveAssociations

Removes all associations for a primary object.

System_CAPS_pubmethod System_CAPS_static RemoveProvider

Removes a previously added type description provider that is associated with the specified object.

System_CAPS_pubmethod System_CAPS_static RemoveProvider

Removes a previously added type description provider that is associated with the specified type.

System_CAPS_pubmethod System_CAPS_static RemoveProviderTransparent

Removes a previously added type description provider that is associated with the specified object.

System_CAPS_pubmethod System_CAPS_static RemoveProviderTransparent

Removes a previously added type description provider that is associated with the specified type.

System_CAPS_pubmethod System_CAPS_static SortDescriptorArray

Sorts descriptors using the name of the descriptor.

System_CAPS_pubmethod ToString

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubevent System_CAPS_static Refreshed

Occurs when the cache for a component is cleared.

The .NET Framework provides two ways to access metadata on a type: the reflection API provided in the System.Reflection namespace, and the TypeDescriptor class. Reflection is a general mechanism available to all types because its foundation is established in the 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 the .NET Framework.

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

Service name

Description

IExtenderProvider

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

ITypeDescriptorFilterService

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

ICustomTypeDescriptor

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

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

All the methods in 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 TypeDescriptor take two different types of parameters: a class type or an object instance.

When you want to access 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 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 Refresh method must be called to update the cache.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top