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.

適用於

另請參閱