TypeDescriptionProvider.GetTypeDescriptor 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得特定型別或物件的自訂型別描述項。
GetTypeDescriptor(Object) |
取得特定物件的自訂型別描述項。 |
GetTypeDescriptor(Type) |
取得特定型別的自訂型別描述項。 |
GetTypeDescriptor(Type, Object) |
取得特定型別和物件的自訂型別描述項。 |
取得特定物件的自訂型別描述項。
public:
System::ComponentModel::ICustomTypeDescriptor ^ GetTypeDescriptor(System::Object ^ instance);
public System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor (object instance);
public System.ComponentModel.ICustomTypeDescriptor? GetTypeDescriptor (object instance);
member this.GetTypeDescriptor : obj -> System.ComponentModel.ICustomTypeDescriptor
Public Function GetTypeDescriptor (instance As Object) As ICustomTypeDescriptor
參數
- instance
- Object
型別的執行個體。 如果未傳遞執行個體至 TypeDescriptor,可以為 null
。
傳回
ICustomTypeDescriptor,可以提供型別的中繼資料。
例外狀況
instance
為 null
。
另請參閱
適用於
.NET 9 和其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
取得特定型別的自訂型別描述項。
public:
System::ComponentModel::ICustomTypeDescriptor ^ GetTypeDescriptor(Type ^ objectType);
public System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor (Type objectType);
public System.ComponentModel.ICustomTypeDescriptor? GetTypeDescriptor (Type objectType);
member this.GetTypeDescriptor : Type -> System.ComponentModel.ICustomTypeDescriptor
Public Function GetTypeDescriptor (objectType As Type) As ICustomTypeDescriptor
參數
- objectType
- Type
要為其擷取型別描述項之物件的型別。
傳回
ICustomTypeDescriptor,可以提供型別的中繼資料。
另請參閱
適用於
.NET 9 和其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
取得特定型別和物件的自訂型別描述項。
public:
virtual System::ComponentModel::ICustomTypeDescriptor ^ GetTypeDescriptor(Type ^ objectType, System::Object ^ instance);
public virtual System.ComponentModel.ICustomTypeDescriptor GetTypeDescriptor (Type objectType, object instance);
public virtual System.ComponentModel.ICustomTypeDescriptor? GetTypeDescriptor (Type objectType, object? instance);
abstract member GetTypeDescriptor : Type * obj -> System.ComponentModel.ICustomTypeDescriptor
override this.GetTypeDescriptor : Type * obj -> System.ComponentModel.ICustomTypeDescriptor
Public Overridable Function GetTypeDescriptor (objectType As Type, instance As Object) As ICustomTypeDescriptor
參數
- objectType
- Type
要為其擷取型別描述項之物件的型別。
- instance
- Object
型別的執行個體。 如果未傳遞執行個體至 TypeDescriptor,可以為 null
。
傳回
ICustomTypeDescriptor,可以提供型別的中繼資料。
備註
如果未傳遞任何父提供者,這個方法的原型 virtual
為 ,而且根據預設,會傳回空的描述元。 如果傳遞父提供者,這個方法會叫用父提供者的 GetTypeDescriptor 方法。
給繼承者的注意事項
方法 GetTypeDescriptor(Type, Object) 應該會傳回 物件的自定義型別描述項。 如果 方法未提供 物件的型別資訊,它應該會傳回 null
。
另請參閱
適用於
.NET 9 和其他版本
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |