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 ,该实例也会包含在返回的数组中。

适用于