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 中用來提供 COM 物件的型別資訊。For example, ICustomTypeDescriptor is used in the .NET Framework to provide type information for COM objects. COM 物件不支援屬性或屬性。COM objects do not support properties or attributes. 因此,.NET Framework 會使用 ICustomTypeDescriptor 來執行 COM 物件的屬性和屬性。Therefore, the .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.

注意

沒有設計階段支援將資料系結至執行介面的物件 ICustomTypeDescriptorThere 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.

適用於

另請參閱