_Type.GetCustomAttributes 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 COM 对象提供与版本无关的访问 GetCustomAttributes 方法。
重载
| 名称 | 说明 |
|---|---|
| GetCustomAttributes(Boolean) |
为 COM 对象提供与版本无关的访问 GetCustomAttributes(Boolean) 方法。 |
| GetCustomAttributes(Type, Boolean) |
为 COM 对象提供与版本无关的访问 GetCustomAttributes(Type, Boolean) 方法。 |
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。
该方法 MemberInfo.GetCustomAttributes 返回应用于此成员的所有属性。
GetCustomAttributes(Boolean)
为 COM 对象提供与版本无关的访问 GetCustomAttributes(Boolean) 方法。
public:
cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public object[] GetCustomAttributes(bool inherit);
abstract member GetCustomAttributes : bool -> obj[]
Public Function GetCustomAttributes (inherit As Boolean) As Object()
参数
- inherit
- Boolean
指定是否搜索此成员的继承链以查找属性。
返回
应用于此成员的自定义特性的数组;如果没有应用任何属性,则为零 (0) 个元素的数组。
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。
该方法 Assembly.GetCustomAttributes 返回应用于此成员的所有属性。
适用于
GetCustomAttributes(Type, Boolean)
为 COM 对象提供与版本无关的访问 GetCustomAttributes(Type, Boolean) 方法。
public:
cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public object[] GetCustomAttributes(Type attributeType, bool inherit);
abstract member GetCustomAttributes : Type * bool -> obj[]
Public Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()
参数
- attributeType
- Type
要搜索的属性的类型。 仅返回可分配给此类型的属性。
- inherit
- Boolean
指定是否搜索此成员的继承链以查找属性。
返回
应用于此成员的自定义特性的数组;如果没有应用任何属性,则为零 (0) 个元素的数组。
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。
该方法 MemberInfo.GetCustomAttributes 返回应用于此成员的所有属性。