ComAwareEventInfo.GetCustomAttributes 方法

定义

在派生类中重写时,返回应用于此成员的所有特性。When overridden in a derived class, returns all attributes that are applied to this member.

重载

GetCustomAttributes(Boolean)

在派生类中重写时,获取一个包含应用于此成员的所有自定义特性的数组。When overridden in a derived class, gets an array that contains all the custom attributes that are applied to this member.

GetCustomAttributes(Type, Boolean)

在派生类中重写时,获取一个数组,该数组包含应用于此成员的指定类型的所有自定义特性。When overridden in a derived class, gets an array that contains all the custom attributes of the specified type that are applied to this member.

GetCustomAttributes(Boolean)

在派生类中重写时,获取一个包含应用于此成员的所有自定义特性的数组。When overridden in a derived class, gets an array that contains all the custom attributes that are applied to this member.

public:
 override cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public override object[] GetCustomAttributes (bool inherit);
override this.GetCustomAttributes : bool -> obj[]
Public Overrides Function GetCustomAttributes (inherit As Boolean) As Object()

参数

inherit
Boolean

如果要搜索此成员的继承链以查找属性,则为 true;否则为 falsetrue to search this member's inheritance chain to find the attributes; otherwise, false.

返回

Object[]

一个包含所有自定义特性的数组,如果未定义任何特性,则为一个包含零个元素的数组。An array that contains all the custom attributes, or an array that has no elements if no attributes were defined.

例外

此成员属于加载到仅反射的上下文的类型。This member belongs to a type that is loaded into the reflection-only context. 请参阅如何:将程序集加载到仅反射上下文中See How to: Load Assemblies into the Reflection-Only Context.

无法加载自定义属性类型。A custom attribute type cannot be loaded.

注解

此方法调用 GetCustomAttributes 基础对象的方法 EventInfoThis method calls the GetCustomAttributes method of the underlying EventInfo object.

另请参阅

GetCustomAttributes(Type, Boolean)

在派生类中重写时,获取一个数组,该数组包含应用于此成员的指定类型的所有自定义特性。When overridden in a derived class, gets an array that contains all the custom attributes of the specified type that are applied to this member.

public:
 override cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public override object[] GetCustomAttributes (Type attributeType, bool inherit);
override this.GetCustomAttributes : Type * bool -> obj[]
Public Overrides Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()

参数

attributeType
Type

要搜索的特性类型。The attribute type to search for. 只能返回可分配给此类型的特性。Only attributes that are assignable to this type can be returned.

inherit
Boolean

如果要搜索此成员的继承链以查找属性,则为 true;否则为 falsetrue to search this member's inheritance chain to find the attributes; otherwise, false.

返回

Object[]

一个包含指定类型的所有自定义特性的数组,如果未定义任何特性,则为一个包含零个元素的数组。An array that contains all the custom attributes of the specified type, or an array that has no elements if no attributes were defined.

例外

attributeTypenullattributeType is null.

此成员属于加载到仅反射的上下文的类型。This member belongs to a type that is loaded into the reflection-only context. 请参阅如何:将程序集加载到仅反射上下文中See How to: Load Assemblies into the Reflection-Only Context

无法加载自定义属性类型。A custom attribute type cannot be loaded.

另请参阅

适用于