TypeDescriptor Class
TOC
Collapse the table of content
Expand the table of content

TypeDescriptor Class

 

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)

System.Object
  System.ComponentModel.TypeDescriptor

[HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)]
public sealed class TypeDescriptor

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticComNativeDescriptorHandler

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_pubpropertySystem_CAPS_staticComObjectType

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

System_CAPS_pubpropertySystem_CAPS_staticInterfaceType

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddAttributes(Object, Attribute[])

Adds class-level attributes to the target component instance.

System_CAPS_pubmethodSystem_CAPS_staticAddAttributes(Type, Attribute[])

Adds class-level attributes to the target component type.

System_CAPS_pubmethodSystem_CAPS_staticAddEditorTable(Type, Hashtable)

Adds an editor table for the given editor base type.

System_CAPS_pubmethodSystem_CAPS_staticAddProvider(TypeDescriptionProvider, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticAddProvider(TypeDescriptionProvider, Type)

Adds a type description provider for a component class.

System_CAPS_pubmethodSystem_CAPS_staticAddProviderTransparent(TypeDescriptionProvider, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticAddProviderTransparent(TypeDescriptionProvider, Type)

Adds a type description provider for a component class.

System_CAPS_pubmethodSystem_CAPS_staticCreateAssociation(Object, Object)

Creates a primary-secondary association between two objects.

System_CAPS_pubmethodSystem_CAPS_staticCreateDesigner(IComponent, Type)

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

System_CAPS_pubmethodSystem_CAPS_staticCreateEvent(Type, EventDescriptor, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticCreateEvent(Type, String, Type, Attribute[])

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_pubmethodSystem_CAPS_staticCreateInstance(IServiceProvider, Type, Type[], Object[])

Creates an object that can substitute for another data type.

System_CAPS_pubmethodSystem_CAPS_staticCreateProperty(Type, PropertyDescriptor, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticCreateProperty(Type, String, Type, Attribute[])

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

System_CAPS_pubmethodEquals(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetAssociation(Type, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetAttributes(Object)

Returns the collection of attributes for the specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetAttributes(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetAttributes(Type)

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

System_CAPS_pubmethodSystem_CAPS_staticGetClassName(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetClassName(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetClassName(Type)

Returns the name of the class for the specified type.

System_CAPS_pubmethodSystem_CAPS_staticGetComponentName(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetComponentName(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetConverter(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetConverter(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetConverter(Type)

Returns a type converter for the specified type.

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultEvent(Object)

Returns the default event for the specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultEvent(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultEvent(Type)

Returns the default event for the specified type of component.

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultProperty(Object)

Returns the default property for the specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultProperty(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetDefaultProperty(Type)

Returns the default property for the specified type of component.

System_CAPS_pubmethodSystem_CAPS_staticGetEditor(Object, Type)

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

System_CAPS_pubmethodSystem_CAPS_staticGetEditor(Object, Type, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetEditor(Type, Type)

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

System_CAPS_pubmethodSystem_CAPS_staticGetEvents(Object)

Returns the collection of events for the specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetEvents(Object, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticGetEvents(Object, Attribute[], Boolean)

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_pubmethodSystem_CAPS_staticGetEvents(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetEvents(Type)

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

System_CAPS_pubmethodSystem_CAPS_staticGetEvents(Type, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticGetFullComponentName(Object)

Returns the fully qualified name of the component.

System_CAPS_pubmethodGetHashCode()

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

System_CAPS_pubmethodSystem_CAPS_staticGetProperties(Object)

Returns the collection of properties for a specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetProperties(Object, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticGetProperties(Object, Attribute[], Boolean)

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_pubmethodSystem_CAPS_staticGetProperties(Object, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticGetProperties(Type)

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

System_CAPS_pubmethodSystem_CAPS_staticGetProperties(Type, Attribute[])

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

System_CAPS_pubmethodSystem_CAPS_staticGetProvider(Object)

Returns the type description provider for the specified component.

System_CAPS_pubmethodSystem_CAPS_staticGetProvider(Type)

Returns the type description provider for the specified type.

System_CAPS_pubmethodSystem_CAPS_staticGetReflectionType(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticGetReflectionType(Type)

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

System_CAPS_pubmethodGetType()

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

System_CAPS_pubmethodSystem_CAPS_staticRefresh(Assembly)

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

System_CAPS_pubmethodSystem_CAPS_staticRefresh(Module)

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

System_CAPS_pubmethodSystem_CAPS_staticRefresh(Object)

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

System_CAPS_pubmethodSystem_CAPS_staticRefresh(Type)

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

System_CAPS_pubmethodSystem_CAPS_staticRemoveAssociation(Object, Object)

Removes an association between two objects.

System_CAPS_pubmethodSystem_CAPS_staticRemoveAssociations(Object)

Removes all associations for a primary object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveProvider(TypeDescriptionProvider, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticRemoveProvider(TypeDescriptionProvider, Type)

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

System_CAPS_pubmethodSystem_CAPS_staticRemoveProviderTransparent(TypeDescriptionProvider, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticRemoveProviderTransparent(TypeDescriptionProvider, Type)

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

System_CAPS_pubmethodSystem_CAPS_staticSortDescriptorArray(IList)

Sorts descriptors using the name of the descriptor.

System_CAPS_pubmethodToString()

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

NameDescription
System_CAPS_pubeventSystem_CAPS_staticRefreshed

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 Site. 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
Show:
© 2016 Microsoft