System.ComponentModel.TypeConverter.GetProperties 方法 (ITypeDescriptorContext, Object, Attribute[])

方法描述

使用指定的上下文和特性返回由 value 参数指定的数组类型的属性的集合。

语法定义(C# System.ComponentModel.TypeConverter.GetProperties 方法 (ITypeDescriptorContext, Object, Attribute[]) 的用法)

public virtual PropertyDescriptorCollection GetProperties(
	ITypeDescriptorContext context,
	Object value,
	Attribute[] attributes
)

参数/返回值

参数值/返回值 参数类型/返回类型 参数描述/返回描述
context System-ComponentModel-ITypeDescriptorContext 一个提供格式上下文的 ITypeDescriptorContext。
value System-Object 一个 Object,指定要为其获取属性的数组类型。
attributes System-Attribute[] 用作筛选器的 Attribute 类型数组。
返回值 System.ComponentModel.PropertyDescriptorCollection 具有为此数据类型公开的属性的 PropertyDescriptorCollection;或者如果没有属性,则为 null。

提示和注释

当在此类中实现时,此方法始终返回 null。

对继承者的说明

如果要转换的类型支持属性,则重写此方法。

使用 context 参数提取有关调用此转换器的环境的附加信息。 此参数可以为 null,所以始终检查它。 同样,上下文对象的属性可以返回 null。

特性数组用于筛选数组。 特性可以同时包含 Type 和 Attribute 对象。 用下列规则定义筛选:

Type 被视为通配符,它匹配在其特性集内具有 Type 的属性。

如果属性不具有同一个类的 Attribute,则该属性不包括在返回的数组中。

如果该特性是 Attribute 的实例,则该属性必须是完全匹配项,否则不包括在返回的数组中。

如果指定 Attribute 实例并且它是默认属性,那么即使在该属性中没有 Attribute 的实例,它也包括在返回的数组中。

System.ComponentModel.TypeConverter.GetProperties 方法 (ITypeDescriptorContext, Object, Attribute[])例子


异常

异常 异常描述

命名空间

namespace: System.ComponentModel

程序集: System(在 System.dll 中)

版本信息

.NET Framework 受以下版本支持:4、3.5、3.0、2.0、1.1、1.0 .NET Framework Client Profile 受以下版本支持:4、3.5 SP1

适用平台

Windows 7, Windows Vista SP1 或更高版本, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008(不支持服务器核心), Windows Server 2008 R2(支持 SP1 或更高版本的服务器核心), Windows Server 2003 SP2 .NET Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。