ICustomTypeDescriptor 接口

定义

提供为对象提供动态自定义类型信息的接口。Provides an interface that supplies dynamic custom type information for an object.

public interface class ICustomTypeDescriptor
public interface ICustomTypeDescriptor
type ICustomTypeDescriptor = interface
Public Interface ICustomTypeDescriptor
派生

注解

ICustomTypeDescriptor接口允许对象提供有关其自身的类型信息。The ICustomTypeDescriptor interface allows an object to provide type information about itself. 通常, 当对象需要动态类型信息时, 使用此接口。Typically, this interface is used when an object needs dynamic type information. 与此TypeDescriptor相反, 类提供从元数据获取的静态类型信息。In contrast, the TypeDescriptor class provides static type information that is obtained from metadata.

例如, ICustomTypeDescriptor .NET Framework.NET Framework在中使用, 以提供 COM 对象的类型信息。For example, ICustomTypeDescriptor is used in the .NET Framework.NET Framework to provide type information for COM objects. COM 对象不支持属性或属性。COM objects do not support properties or attributes. 因此, .NET Framework.NET Framework使用ICustomTypeDescriptor来实现 COM 对象的属性和属性。Therefore, the .NET Framework.NET Framework uses ICustomTypeDescriptor to implement properties and attributes for COM objects.

若要提供动态自定义类型信息, 类可以ICustomTypeDescriptor实现或派生CustomTypeDescriptor自类, 该类提供此接口的简单实现。To provide dynamic custom type information, a class can implement ICustomTypeDescriptor or derive from the CustomTypeDescriptor class, which provides a simple implementation of this interface.

备注

对于对实现ICustomTypeDescriptor接口的对象的数据绑定, 不提供设计时支持。There is no design-time support for data binding to objects that implement the ICustomTypeDescriptor interface. 此外, 在绑定到的运行时实例ICustomTypeDescriptor时, 将忽略基础类型的公共属性。In addition, when binding to a runtime instance of ICustomTypeDescriptor, the public properties of the underlying type are ignored.

方法

GetAttributes()

返回此组件实例的自定义属性的集合。Returns a collection of custom attributes for this instance of a component.

GetClassName()

返回此组件实例的类名称。Returns the class name of this instance of a component.

GetComponentName()

返回某个组件的此实例的名称。Returns the name of this instance of a component.

GetConverter()

返回此组件实例的类型转换器。Returns a type converter for this instance of a component.

GetDefaultEvent()

返回某个组件的此实例的默认事件。Returns the default event for this instance of a component.

GetDefaultProperty()

返回此组件实例的默认属性。Returns the default property for this instance of a component.

GetEditor(Type)

返回此组件实例的指定类型的编辑器。Returns an editor of the specified type for this instance of a component.

GetEvents()

返回此组件实例的事件。Returns the events for this instance of a component.

GetEvents(Attribute[])

使用指定的属性数组作为筛选器,返回此组件实例的事件。Returns the events for this instance of a component using the specified attribute array as a filter.

GetProperties()

返回此组件实例的属性。Returns the properties for this instance of a component.

GetProperties(Attribute[])

使用特性数组作为筛选器,返回此组件实例的属性。Returns the properties for this instance of a component using the attribute array as a filter.

GetPropertyOwner(PropertyDescriptor)

返回一个对象,该对象包含指定的属性描述符所描述的属性。Returns an object that contains the property described by the specified property descriptor.

适用于

另请参阅