CollectionConverter.GetProperties 方法

定義

使用指定的內容和屬性 (Attribute),取得由值參數所指定之陣列型別的屬性 (Property) 集合。

public:
 override System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value, cli::array <Attribute ^> ^ attributes);
public override System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes);
public override System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext? context, object value, Attribute[]? attributes);
override this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Overrides 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 ,它也會包含在傳回的陣列中。

集合不支援屬性;因此,這個方法一律會傳 null 回 。

適用於

另請參閱