ICustomAttributeProvider.GetCustomAttributes 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回在此成员上定义的自定义属性。
重载
| 名称 | 说明 |
|---|---|
| GetCustomAttributes(Boolean) |
返回此成员上定义的所有自定义属性的数组,不包括命名属性,如果没有自定义属性,则返回空数组。 |
| GetCustomAttributes(Type, Boolean) |
返回在此成员上定义的自定义属性的数组(按类型标识)或空数组(如果没有该类型的自定义属性)。 |
GetCustomAttributes(Boolean)
- Source:
- ICustomAttributeProvider.cs
- Source:
- ICustomAttributeProvider.cs
- Source:
- Lzcnt.cs
返回此成员上定义的所有自定义属性的数组,不包括命名属性,如果没有自定义属性,则返回空数组。
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
在查找继承的自定义属性的层次结构链时 true。
返回
表示自定义属性或空数组的对象数组。
例外
无法加载自定义属性类型。
注解
ICustomAttributeProvider.GetCustomAttributes调用PropertyInfo或EventInfoinherit当参数GetCustomAttributestrue不走类型层次结构时。 用于 System.Attribute 继承自定义属性。
此方法仅返回直接在非继承成员上定义的自定义属性。
适用于
GetCustomAttributes(Type, Boolean)
- Source:
- ICustomAttributeProvider.cs
- Source:
- ICustomAttributeProvider.cs
- Source:
- Lzcnt.cs
返回在此成员上定义的自定义属性的数组(按类型标识)或空数组(如果没有该类型的自定义属性)。
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
在查找继承的自定义属性的层次结构链时 true。
返回
表示自定义属性或空数组的对象数组。
例外
无法加载自定义属性类型。
attributeType 是 null。
注解
如果 attributeType 为基类或接口,此方法将返回该类型的任何实现。
此方法仅返回直接在非继承成员上定义的自定义属性。
ICustomAttributeProvider.GetCustomAttributes调用PropertyInfo或EventInfoinherit当参数GetCustomAttributestrue不走类型层次结构时。 用于 System.Attribute 继承自定义属性。