TypeConverter.GetProperties 方法

定義

傳回由值參數所指定的陣列型別的屬性集合。

多載

GetProperties(Object)

傳回由值參數所指定的陣列型別的屬性集合。

GetProperties(ITypeDescriptorContext, Object)

會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。

GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的內容和屬性 (attribute),傳回由該值參數所指定之陣列類型的屬性 (property) 集合。

GetProperties(Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

傳回由值參數所指定的陣列型別的屬性集合。

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ value);
public System.ComponentModel.PropertyDescriptorCollection GetProperties (object value);
public System.ComponentModel.PropertyDescriptorCollection? GetProperties (object value);
member this.GetProperties : obj -> System.ComponentModel.PropertyDescriptorCollection
Public Function GetProperties (value As Object) As PropertyDescriptorCollection

參數

value
Object

Object,指定要取得屬性之陣列的型別。

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 null

備註

在這個類別中實作時,這個方法永遠傳回 null

根據預設,類型不會傳回屬性。 這個方法的簡單實作可以呼叫 GetProperties 正確的資料類型。

適用於

GetProperties(ITypeDescriptorContext, Object)

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value);
public System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext context, object value);
public System.ComponentModel.PropertyDescriptorCollection? GetProperties (System.ComponentModel.ITypeDescriptorContext? context, object value);
member this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj -> System.ComponentModel.PropertyDescriptorCollection
Public Function GetProperties (context As ITypeDescriptorContext, value As Object) As PropertyDescriptorCollection

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContext

value
Object

Object,指定要取得屬性之陣列的型別。

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 null

備註

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。 此參數可以是 null ,因此請一律檢查它。 甚至,內容物件上的屬性可能會傳回 null

在這個類別中實作時,這個方法永遠傳回 null

根據預設,類型不會傳回屬性。 這個方法的簡單實作可以呼叫 GetProperties 正確的資料類型。

另請參閱

適用於

GetProperties(ITypeDescriptorContext, Object, Attribute[])

來源:
TypeConverter.cs
來源:
TypeConverter.cs
來源:
TypeConverter.cs

使用指定的內容和屬性 (attribute),傳回由該值參數所指定之陣列類型的屬性 (property) 集合。

public:
 virtual System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value, cli::array <Attribute ^> ^ attributes);
public virtual System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes);
public virtual System.ComponentModel.PropertyDescriptorCollection? GetProperties (System.ComponentModel.ITypeDescriptorContext? context, object value, Attribute[]? attributes);
abstract member GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
override this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Overridable Function GetProperties (context As ITypeDescriptorContext, value As Object, attributes As Attribute()) As PropertyDescriptorCollection

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContext

value
Object

Object,指定要取得屬性之陣列的型別。

attributes
Attribute[]

Attribute 類型陣列,可當做篩選條件使用。

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 null

備註

在這個類別中實作時,這個方法永遠傳回 null

給繼承者的注意事項

如果您想要轉換的類型支援屬性,請覆寫這個方法。

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。 此參數可以是 null ,因此請一律檢查它。 甚至,內容物件上的屬性可能會傳回 null

屬性陣列是用來篩選陣列。 屬性可以混合和 TypeAttribute 物件。 篩選是由下列規則所定義:

  • Type會被視為萬用字元;它會比對在其屬性集中具有 Type 的屬性。

  • 如果屬性沒有 Attribute 相同類別的 ,則屬性不會包含在傳回的陣列中。

  • 如果 屬性是 的 Attribute 實例,則屬性必須是完全相符的,或未包含在傳回的陣列中。

  • 如果指定 Attribute 實例,而且它是預設屬性,即使 屬性中沒有 的實例 Attribute ,它也會包含在傳回的陣列中。

另請參閱

適用於