Share via


ComponentConverter.GetProperties 方法

定義

取得由值參數所指定的元件型別的屬性集合。

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

備註

可以使用 context 參數來擷取環境的其他資訊,而這個轉換子就是從這個環境叫用的。 這可能是 null,所以一定要檢查。 甚至,內容物件上的屬性可能會傳回 null

陣列 attributes 將用來篩選陣列。 attributes可以混Type用和 Attribute 物件。 篩選是由下列規則所定義:

  • Type物件會被視為通配符;它會比對在其屬性集中具有 Type 的任何屬性。

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

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

  • Attribute如果指定實例,而且它是默認屬性,即使 屬性中沒有的實例Attribute,它也會包含在傳回的數位中。

適用於