TypeConverter.GetProperties Method

Definition

返回由值参数指定的数组类型的属性集合。Returns a collection of properties for the type of array specified by the value parameter.

Overloads

GetProperties(Object)

返回由值参数指定的数组类型的属性集合。Returns a collection of properties for the type of array specified by the value parameter.

GetProperties(ITypeDescriptorContext, Object)

使用指定的上下文返回值参数指定的数组类型的属性的集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的上下文和特性返回由该值参数指定的数组类型的属性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

GetProperties(Object)

返回由值参数指定的数组类型的属性集合。Returns a collection of properties for the type of array specified by the value parameter.

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

Parameters

value
Object

一个 Object,它指定要为其获取属性的数组类型。An Object that specifies the type of array for which to get properties.

Returns

PropertyDescriptorCollection

具有为此数据类型公开的属性的 PropertyDescriptorCollection,或者,如果没有属性,则为 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

Remarks

当在此类中实现时,此方法始终返回 nullAs implemented in this class, this method always returns null.

默认情况下,类型不返回属性。By default, a type does not return properties. 此方法的简单实现可以为正确的数据类型调用 GetPropertiesAn easy implementation of this method can call GetProperties for the correct data type.

GetProperties(ITypeDescriptorContext, Object)

使用指定的上下文返回值参数指定的数组类型的属性的集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::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

Parameters

context
ITypeDescriptorContext

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

value
Object

一个 Object,它指定要为其获取属性的数组类型。An Object that specifies the type of array for which to get properties.

Returns

PropertyDescriptorCollection

具有为此数据类型公开的属性的 PropertyDescriptorCollection,或者,如果没有属性,则为 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

Remarks

使用 context 参数提取有关调用此转换器的环境的附加信息。Use the context parameter to extract additional information about the environment from which this converter is invoked. 此参数可以 null,因此请始终选中此参数。This parameter can be null, so always check it. 同样,上下文对象的属性可以返回 nullAlso, properties on the context object can return null.

当在此类中实现时,此方法始终返回 nullAs implemented in this class, this method always returns null.

默认情况下,类型不返回属性。By default, a type does not return properties. 此方法的简单实现可以为正确的数据类型调用 GetPropertiesAn easy implementation of this method can call GetProperties for the correct data type.

See also

GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的上下文和特性返回由该值参数指定的数组类型的属性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

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);
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

Parameters

context
ITypeDescriptorContext

一个 ITypeDescriptorContext,用于提供格式上下文。An ITypeDescriptorContext that provides a format context.

value
Object

一个 Object,它指定要为其获取属性的数组类型。An Object that specifies the type of array for which to get properties.

attributes
Attribute[]

用作筛选器的 Attribute 类型数组。An array of type Attribute that is used as a filter.

Returns

PropertyDescriptorCollection

具有为此数据类型公开的属性的 PropertyDescriptorCollection,或者,如果没有属性,则为 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

Remarks

当在此类中实现时,此方法始终返回 nullAs implemented in this class, this method always returns null.

Notes to Inheritors

如果要转换的类型支持属性,则重写此方法。Override this method if the type you want to convert supports properties.

使用 context 参数提取有关调用此转换器的环境的附加信息。Use the context parameter to extract additional information about the environment from which this converter is invoked. 此参数可以 null,因此请始终选中此参数。This parameter can be null, so always check it. 同样,上下文对象的属性可以返回 nullAlso, properties on the context object can return null.

特性数组用于筛选数组。The attributes array is used to filter the array. 这些属性可以混合使用 TypeAttribute 对象。The attributes can have a mix of Type and Attribute objects. 筛选由以下规则定义:Filtering is defined by the following rules: -将 Type 视为通配符;它与属性集内具有 Type 的属性相匹配。- A Type is treated as a wildcard; it matches a property that has the Type in its set of attributes.

-如果属性没有相同类的 Attribute,则返回的数组中不包含该属性。- If a property does not have an Attribute of the same class, the property is not included in the returned array.

-如果该属性是 Attribute的实例,则该属性必须是完全匹配项,否则它不会包含在返回的数组中。- If the attribute is an instance of Attribute, the property must be an exact match or it is not included in the returned array.

-如果指定了 Attribute 实例并且它是默认属性,则即使属性中没有 Attribute 的实例,它也会包含在返回的数组中。- If an Attribute instance is specified and it is the default property, it is included in the returned array even if there is no instance of the Attribute in the property.

See also

Applies to