Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​ComponentModel.​TypeDescriptor
Assembly: System.ComponentModel.TypeConverter
Inheritance: object → TypeDescriptor
Provides information about the characteristics for a component, such as its attributes, properties, and events. This class cannot be inherited.
Properties
public static
IComNativeDescriptorHandler
ComNativeDescriptorHandler
Gets or sets the provider for the Component Object Model (COM) type information for the target component.
public static
Type
ComObjectType
Gets the type of the Component Object Model (COM) object represented by the target component.
public static
Type
InterfaceType
Gets a type that represents a type description provider for all interface types.
Methods
public static
TypeDescriptionProvider
AddAttributes​(object instance,
Attribute[] attributes)
Adds class-level attributes to the target component instance.
Returns The newly created <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> that was used to add the specified attributes.
instance
An instance of the target component.
attributes
An array of <see cref="T:System.Attribute" /> objects to add to the component's class.
public static
TypeDescriptionProvider
AddAttributes​(Type type,
Attribute[] attributes)
Adds class-level attributes to the target component type.
Returns The newly created <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> that was used to add the specified attributes.
type
The <see cref="T:System.Type" /> of the target component.
attributes
An array of <see cref="T:System.Attribute" /> objects to add to the component's class.
public static
void
AddEditorTable​(Type editorBaseType,
Collections.​Hashtable table)
Adds an editor table for the given editor base type.
editorBaseType
The editor base type to add the editor table for. If a table already exists for this type, this method will do nothing.
table
The <see cref="T:System.Collections.Hashtable" /> to add.
public static
void
RegisterType​()
Registers the type so it can be used by reflection-based providers in trimmed applications.
public static
void
AddProvider​(TypeDescriptionProvider provider,
object instance)
Adds a type description provider for a single instance of a component.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to add.
instance
An instance of the target component.
public static
void
AddProvider​(TypeDescriptionProvider provider,
Type type)
Adds a type description provider for a component class.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to add.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
AddProviderTransparent​(TypeDescriptionProvider provider,
object instance)
Adds a type description provider for a single instance of a component.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to add.
instance
An instance of the target component.
public static
void
AddProviderTransparent​(TypeDescriptionProvider provider,
Type type)
Adds a type description provider for a component class.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to add.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
CreateAssociation​(object primary,
object secondary)
Creates a primary-secondary association between two objects.
primary
The primary <see cref="T:System.Object" /> .
secondary
The secondary <see cref="T:System.Object" /> .
public static
IDesigner
CreateDesigner​(IComponent component,
Type designerBaseType)
Creates an instance of the designer associated with the specified component and of the specified type of designer.
Returns An <see cref="T:System.ComponentModel.Design.IDesigner" /> that is an instance of the designer for the component, or <see langword="null" /> if no designer can be found.
component
An <see cref="T:System.ComponentModel.IComponent" /> that specifies the component to associate with the designer.
designerBaseType
A <see cref="T:System.Type" /> that represents the type of designer to create.
public static
EventDescriptor
CreateEvent​(Type componentType,
EventDescriptor oldEventDescriptor,
Attribute[] attributes)
Creates a new event descriptor that is identical to an existing event descriptor, when passed the existing <see cref="T:System.ComponentModel.EventDescriptor" /> .
Returns A new <see cref="T:System.ComponentModel.EventDescriptor" /> that has merged the specified metadata attributes with the existing metadata attributes.
componentType
The type of the component for which to create the new event.
oldEventDescriptor
The existing event information.
attributes
The new attributes.
public static
EventDescriptor
CreateEvent​(Type componentType,
string name,
Type type,
Attribute[] attributes)
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.
Returns An <see cref="T:System.ComponentModel.EventDescriptor" /> that is bound to a type.
componentType
The type of the component the event lives on.
name
The name of the event.
type
The type of the delegate that handles the event.
attributes
The attributes for this event.
public static
object
CreateInstance​(IServiceProvider provider,
Type objectType,
Type[] argTypes,
object[] args)
Creates an object that can substitute for another data type.
Returns An instance of the substitute data type if an associated <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> is found; otherwise, <see langword="null" /> .
provider
The service provider that provides a <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> service. This parameter can be <see langword="null" /> .
objectType
The <see cref="T:System.Type" /> of object to create.
argTypes
An optional array of parameter types to be passed to the object's constructor. This parameter can be <see langword="null" /> or an array of zero length.
args
An optional array of parameter values to pass to the object's constructor. If not <see langword="null" /> , the number of elements must be the same as <paramref name="argTypes" /> .
public static
PropertyDescriptor
CreateProperty​(Type componentType,
PropertyDescriptor oldPropertyDescriptor,
Attribute[] attributes)
Creates a new property descriptor from an existing property descriptor, using the specified existing <see cref="T:System.ComponentModel.PropertyDescriptor" /> and attribute array.
Returns A new <see cref="T:System.ComponentModel.PropertyDescriptor" /> that has the specified metadata attributes merged with the existing metadata attributes.
componentType
The <see cref="T:System.Type" /> of the component that the property is a member of.
oldPropertyDescriptor
The existing property descriptor.
attributes
The new attributes for this property.
public static
PropertyDescriptor
CreateProperty​(Type componentType,
string name,
Type type,
Attribute[] attributes)
Creates and dynamically binds a property descriptor to a type, using the specified property name, type, and attribute array.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptor" /> that is bound to the specified type and that has the specified metadata attributes merged with the existing metadata attributes.
componentType
The <see cref="T:System.Type" /> of the component that the property is a member of.
name
The name of the property.
type
The <see cref="T:System.Type" /> of the property.
attributes
The new attributes for this property.
public static
object
GetAssociation​(Type type,
object primary)
Returns an instance of the type associated with the specified primary object.
Returns An instance of the secondary type that has been associated with the primary object if an association exists; otherwise, <paramref name="primary" /> if no specified association exists.
type
The <see cref="T:System.Type" /> of the target component.
primary
The primary object of the association.
public static
AttributeCollection
GetAttributes​(object component)
Returns the collection of attributes for the specified component.
Returns An <see cref="T:System.ComponentModel.AttributeCollection" /> containing the attributes for the component. If <paramref name="component" /> is <see langword="null" /> , this method returns an empty collection.
component
The component for which you want to get attributes.
public static
AttributeCollection
GetAttributes​(object component,
bool noCustomTypeDesc)
Returns a collection of attributes for the specified component and a Boolean indicating that a custom type descriptor has been created.
Returns An <see cref="T:System.ComponentModel.AttributeCollection" /> with the attributes for the component. If the component is <see langword="null" /> , this method returns an empty collection.
component
The component for which you want to get attributes.
noCustomTypeDesc
<see langword="true" /> to use a baseline set of attributes from the custom type descriptor if <paramref name="component" /> is of type <see cref="T:System.ComponentModel.ICustomTypeDescriptor" /> ; otherwise, <see langword="false" /> .
public static
AttributeCollection
GetAttributes​(Type componentType)
Returns a collection of attributes for the specified type of component.
Returns An <see cref="T:System.ComponentModel.AttributeCollection" /> with the attributes for the type of the component. If the component is <see langword="null" /> , this method returns an empty collection.
componentType
The <see cref="T:System.Type" /> of the target component.
public static
string
GetClassName​(object component)
Returns the name of the class for the specified component using the default type descriptor.
Returns A <see cref="T:System.String" /> containing the name of the class for the specified component.
component
The <see cref="T:System.Object" /> for which you want the class name.
public static
string
GetClassName​(object component,
bool noCustomTypeDesc)
Returns the name of the class for the specified component using a custom type descriptor.
Returns A <see cref="T:System.String" /> containing the name of the class for the specified component.
component
The <see cref="T:System.Object" /> for which you want the class name.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
string
GetClassName​(Type componentType)
Returns the name of the class for the specified type.
Returns A <see cref="T:System.String" /> containing the name of the class for the specified component type.
componentType
The <see cref="T:System.Type" /> of the target component.
public static
string
GetComponentName​(object component)
Returns the name of the specified component using the default type descriptor.
Returns A <see cref="T:System.String" /> containing the name of the specified component, or <see langword="null" /> if there is no component name.
component
The <see cref="T:System.Object" /> for which you want the class name.
public static
string
GetComponentName​(object component,
bool noCustomTypeDesc)
Returns the name of the specified component using a custom type descriptor.
Returns The name of the class for the specified component, or <see langword="null" /> if there is no component name.
component
The <see cref="T:System.Object" /> for which you want the class name.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
TypeConverter
GetConverter​(object component)
Returns a type converter for the type of the specified component.
Returns A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified component.
component
A component to get the converter for.
public static
TypeConverter
GetConverter​(object component,
bool noCustomTypeDesc)
Returns a type converter for the type of the specified component with a custom type descriptor.
Returns A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified component.
component
A component to get the converter for.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
TypeConverter
GetConverter​(Type type)
Returns a type converter for the specified type.
Returns A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type.
type
The <see cref="T:System.Type" /> of the target component.
public static
TypeConverter
GetConverterFromRegisteredType​(object component)
Gets a type converter for the type of the specified component.
Returns A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified component.
component
A component to get the converter for.
public static
TypeConverter
GetConverterFromRegisteredType​(Type type)
Gets a type converter for the specified registered type.
Returns A <see cref="T:System.ComponentModel.TypeConverter" /> for the specified type.
type
The <see cref="T:System.Type" /> of the target component.
public static
EventDescriptor
GetDefaultEvent​(object component)
Returns the default event for the specified component.
Returns An <see cref="T:System.ComponentModel.EventDescriptor" /> with the default event, or <see langword="null" /> if there are no events.
component
The component to get the event for.
public static
EventDescriptor
GetDefaultEvent​(object component,
bool noCustomTypeDesc)
Returns the default event for a component with a custom type descriptor.
Returns An <see cref="T:System.ComponentModel.EventDescriptor" /> with the default event, or <see langword="null" /> if there are no events.
component
The component to get the event for.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
EventDescriptor
GetDefaultEvent​(Type componentType)
Returns the default event for the specified type of component.
Returns An <see cref="T:System.ComponentModel.EventDescriptor" /> with the default event, or <see langword="null" /> if there are no events.
componentType
The <see cref="T:System.Type" /> of the target component.
public static
PropertyDescriptor
GetDefaultProperty​(object component)
Returns the default property for the specified component.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptor" /> with the default property, or <see langword="null" /> if there are no properties.
component
The component to get the default property for.
public static
PropertyDescriptor
GetDefaultProperty​(object component,
bool noCustomTypeDesc)
Returns the default property for the specified component with a custom type descriptor.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptor" /> with the default property, or <see langword="null" /> if there are no properties.
component
The component to get the default property for.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
PropertyDescriptor
GetDefaultProperty​(Type componentType)
Returns the default property for the specified type of component.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptor" /> with the default property, or <see langword="null" /> if there are no properties.
componentType
A <see cref="T:System.Type" /> that represents the class to get the property for.
public static
object
GetEditor​(object component,
Type editorBaseType)
Gets an editor with the specified base type for the specified component.
Returns An instance of the editor that can be cast to the specified editor type, or <see langword="null" /> if no editor of the requested type can be found.
component
The component to get the editor for.
editorBaseType
A <see cref="T:System.Type" /> that represents the base type of the editor you want to find.
public static
object
GetEditor​(object component,
Type editorBaseType,
bool noCustomTypeDesc)
Returns an editor with the specified base type and with a custom type descriptor for the specified component.
Returns An instance of the editor that can be cast to the specified editor type, or <see langword="null" /> if no editor of the requested type can be found.
component
The component to get the editor for.
editorBaseType
A <see cref="T:System.Type" /> that represents the base type of the editor you want to find.
noCustomTypeDesc
A flag indicating whether custom type description information should be considered.
public static
object
GetEditor​(Type type,
Type editorBaseType)
Returns an editor with the specified base type for the specified type.
Returns An instance of the editor object that can be cast to the given base type, or <see langword="null" /> if no editor of the requested type can be found.
type
The <see cref="T:System.Type" /> of the target component.
editorBaseType
A <see cref="T:System.Type" /> that represents the base type of the editor you are trying to find.
public static
EventDescriptorCollection
GetEvents​(object component)
Returns the collection of events for the specified component.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events for this component.
component
A component to get the events for.
public static
EventDescriptorCollection
GetEvents​(object component,
Attribute[] attributes)
Returns the collection of events for a specified component using a specified array of attributes as a filter.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events that match the specified attributes for this component.
component
A component to get the events for.
attributes
An array of type <see cref="T:System.Attribute" /> that you can use as a filter.
public static
EventDescriptorCollection
GetEvents​(object component,
Attribute[] attributes,
bool noCustomTypeDesc)
Returns the collection of events for a specified component using a specified array of attributes as a filter and using a custom type descriptor.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events that match the specified attributes for this component.
component
A component to get the events for.
attributes
An array of type <see cref="T:System.Attribute" /> to use as a filter.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
EventDescriptorCollection
GetEvents​(object component,
bool noCustomTypeDesc)
Returns the collection of events for a specified component with a custom type descriptor.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events for this component.
component
A component to get the events for.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
EventDescriptorCollection
GetEvents​(Type componentType)
Returns the collection of events for a specified type of component.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events for this component.
componentType
The <see cref="T:System.Type" /> of the target component.
public static
EventDescriptorCollection
GetEvents​(Type componentType,
Attribute[] attributes)
Returns the collection of events for a specified type of component using a specified array of attributes as a filter.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events that match the specified attributes for this component.
componentType
The <see cref="T:System.Type" /> of the target component.
attributes
An array of type <see cref="T:System.Attribute" /> that you can use as a filter.
public static
EventDescriptorCollection
GetEventsFromRegisteredType​(Type componentType)
Gets a collection of events for a specified type of component.
Returns An <see cref="T:System.ComponentModel.EventDescriptorCollection" /> with the events for this component.
componentType
The <see cref="T:System.Type" /> of the target component.
public static
string
GetFullComponentName​(object component)
Returns the fully qualified name of the component.
Returns The fully qualified name of the specified component, or <see langword="null" /> if the component has no name.
component
The <see cref="T:System.ComponentModel.Component" /> to find the name for.
public static
PropertyDescriptorCollection
GetProperties​(object component)
Returns the collection of properties for a specified component.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties for the specified component.
component
A component to get the properties for.
public static
PropertyDescriptorCollection
GetProperties​(object component,
Attribute[] attributes)
Returns the collection of properties for a specified component using a specified array of attributes as a filter.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that match the specified attributes for the specified component.
component
A component to get the properties for.
attributes
An array of type <see cref="T:System.Attribute" /> to use as a filter.
public static
PropertyDescriptorCollection
GetProperties​(object component,
Attribute[] attributes,
bool noCustomTypeDesc)
Returns the collection of properties for a specified component using a specified array of attributes as a filter and using a custom type descriptor.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the events that match the specified attributes for the specified component.
component
A component to get the properties for.
attributes
An array of type <see cref="T:System.Attribute" /> to use as a filter.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
PropertyDescriptorCollection
GetProperties​(object component,
bool noCustomTypeDesc)
Returns the collection of properties for a specified component using the default type descriptor.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties for a specified component.
component
A component to get the properties for.
noCustomTypeDesc
<see langword="true" /> to not consider custom type description information; otherwise, <see langword="false" /> .
public static
PropertyDescriptorCollection
GetProperties​(Type componentType)
Returns the collection of properties for a specified type of component.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties for a specified type of component.
componentType
A <see cref="T:System.Type" /> that represents the component to get properties for.
public static
PropertyDescriptorCollection
GetProperties​(Type componentType,
Attribute[] attributes)
Returns the collection of properties for a specified type of component using a specified array of attributes as a filter.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that match the specified attributes for this type of component.
componentType
The <see cref="T:System.Type" /> of the target component.
attributes
An array of type <see cref="T:System.Attribute" /> to use as a filter.
public static
PropertyDescriptorCollection
GetPropertiesFromRegisteredType​(Type componentType)
Gets a collection of properties for a specified type.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties for a specified type of component.
componentType
A <see cref="T:System.Type" /> that represents the component to get properties for.
public static
PropertyDescriptorCollection
GetPropertiesFromRegisteredType​(object component)
Gets a collection of properties for a specified component.
Returns A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties for the specified component.
component
A component to get the properties for.
public static
TypeDescriptionProvider
GetProvider​(object instance)
Returns the type description provider for the specified component.
Returns A <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> associated with the specified component.
instance
An instance of the target component.
public static
TypeDescriptionProvider
GetProvider​(Type type)
Returns the type description provider for the specified type.
Returns A <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> associated with the specified type.
type
The <see cref="T:System.Type" /> of the target component.
public static
Type
GetReflectionType​(object instance)
Returns a <see cref="T:System.Type" /> that can be used to perform reflection, given an object.
Returns A <see cref="T:System.Type" /> for the specified object.
instance
An instance of the target component.
public static
Type
GetReflectionType​(Type type)
Returns a <see cref="T:System.Type" /> that can be used to perform reflection, given a class type.
Returns A <see cref="T:System.Type" /> of the specified class.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
Refresh​(object component)
Clears the properties and events for the specified component from the cache.
component
A component for which the properties or events have changed.
public static
void
Refresh​(Reflection.​Assembly assembly)
Clears the properties and events for the specified assembly from the cache.
assembly
The <see cref="T:System.Reflection.Assembly" /> that represents the assembly to refresh. Each <see cref="T:System.Type" /> in this assembly will be refreshed.
public static
void
Refresh​(Reflection.​Module module)
Clears the properties and events for the specified module from the cache.
module
The <see cref="T:System.Reflection.Module" /> that represents the module to refresh. Each <see cref="T:System.Type" /> in this module will be refreshed.
public static
void
Refresh​(Type type)
Clears the properties and events for the specified type of component from the cache.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
RemoveAssociation​(object primary,
object secondary)
Removes an association between two objects.
primary
The primary <see cref="T:System.Object" /> .
secondary
The secondary <see cref="T:System.Object" /> .
public static
void
RemoveAssociations​(object primary)
Removes all associations for a primary object.
primary
The primary <see cref="T:System.Object" /> in an association.
public static
void
RemoveProvider​(TypeDescriptionProvider provider,
object instance)
Removes a previously added type description provider that is associated with the specified object.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to remove.
instance
An instance of the target component.
public static
void
RemoveProvider​(TypeDescriptionProvider provider,
Type type)
Removes a previously added type description provider that is associated with the specified type.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to remove.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
RemoveProviderTransparent​(TypeDescriptionProvider provider,
object instance)
Removes a previously added type description provider that is associated with the specified object.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to remove.
instance
An instance of the target component.
public static
void
RemoveProviderTransparent​(TypeDescriptionProvider provider,
Type type)
Removes a previously added type description provider that is associated with the specified type.
provider
The <see cref="T:System.ComponentModel.TypeDescriptionProvider" /> to remove.
type
The <see cref="T:System.Type" /> of the target component.
public static
void
SortDescriptorArray​(Collections.​IList infos)
Sorts descriptors using the name of the descriptor.
infos
An <see cref="T:System.Collections.IList" /> that contains the descriptors to sort.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object