_MemberInfo.GetCustomAttributes 方法
定义
为 COM 对象提供对 GetCustomAttributes 方法的与版本无关的访问。Provides COM objects with version-independent access to the GetCustomAttributes method.
重载
| GetCustomAttributes(Boolean) |
为 COM 对象提供对 GetCustomAttributes(Boolean) 方法的与版本无关的访问。Provides COM objects with version-independent access to the GetCustomAttributes(Boolean) method. |
| GetCustomAttributes(Type, Boolean) |
为 COM 对象提供对 GetCustomAttributes(Type, Boolean) 方法的与版本无关的访问。Provides COM objects with version-independent access to the GetCustomAttributes(Type, Boolean) method. |
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。This method is for access to managed classes from unmanaged code and should not be called from managed code.
MemberInfo.GetCustomAttributes方法返回应用于此成员的所有属性。The MemberInfo.GetCustomAttributes method returns all attributes applied to this member.
GetCustomAttributes(Boolean)
为 COM 对象提供对 GetCustomAttributes(Boolean) 方法的与版本无关的访问。Provides COM objects with version-independent access to the GetCustomAttributes(Boolean) method.
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;否则为 false。true to search this member's inheritance chain to find the attributes; otherwise, false.
返回
- Object[]
一个包含所有自定义属性的数组,在未定义任何特性时为包含零 (0) 个元素的数组。An array that contains all the custom attributes, or an array with zero (0) elements if no attributes are defined.
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。This method is for access to managed classes from unmanaged code and should not be called from managed code.
MemberInfo.GetCustomAttributes方法返回包含所有自定义属性的数组。The MemberInfo.GetCustomAttributes method returns an array containing all the custom attributes.
适用于
GetCustomAttributes(Type, Boolean)
为 COM 对象提供对 GetCustomAttributes(Type, Boolean) 方法的与版本无关的访问。Provides COM objects with version-independent access to the GetCustomAttributes(Type, Boolean) method.
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
要搜索的属性的类型。The type of attribute to search for. 仅返回可分配给此类型的属性。Only attributes that are assignable to this type are returned.
- inherit
- Boolean
如果要搜索此成员的继承链以查找属性,则为 true;否则为 false。true to search this member's inheritance chain to find the attributes; otherwise, false.
返回
- Object[]
应用于此成员的自定义属性的数组;如果未应用任何特性,则为包含零 (0) 个元素的数组。An array of custom attributes applied to this member, or an array with zero (0) elements if no attributes have been applied.
注解
此方法用于从非托管代码访问托管类,不应从托管代码调用。This method is for access to managed classes from unmanaged code and should not be called from managed code.
Assembly.GetCustomAttributes方法返回由标识的自定义特性的数组 Type 。The Assembly.GetCustomAttributes method returns an array of custom attributes identified by Type.