ICustomTypeDescriptor Interface

Definition

提供为对象提供动态自定义类型信息的接口。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
Derived

Remarks

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.

例如,在 .NET Framework.NET Framework 中使用 ICustomTypeDescriptor 来提供 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.

Note

对于实现 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.

Methods

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.

Applies to

See also