TypeDelegator.GetCustomAttributes 方法

定义

返回为此类型定义的所有自定义属性。Returns all the custom attributes defined for this type.

重载

GetCustomAttributes(Boolean)

返回为此类型定义的所有自定义属性,并指定是否搜索此类型的继承链。Returns all the custom attributes defined for this type, specifying whether to search the type's inheritance chain.

GetCustomAttributes(Type, Boolean)

返回由类型标识的自定义属性数组。Returns an array of custom attributes identified by type.

GetCustomAttributes(Boolean)

返回为此类型定义的所有自定义属性,并指定是否搜索此类型的继承链。Returns all the custom attributes defined for this type, specifying whether to search the type's inheritance chain.

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

指定是否搜索此类型的继承链以查找这些属性。Specifies whether to search this type's inheritance chain to find the attributes.

返回

Object[]

一个包含为此类型定义的所有自定义属性的对象数组。An array of objects containing all the custom attributes defined for this type.

异常

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

GetCustomAttributes(Type, Boolean)

返回由类型标识的自定义属性数组。Returns an array of custom attributes identified by type.

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

由类型标识的自定义属性数组。An array of custom attributes identified by type.

inherit
Boolean

指定是否搜索此类型的继承链以查找这些属性。Specifies whether to search this type's inheritance chain to find the attributes.

返回

Object[]

一个对象数组,包含此类型中定义的与 attributeType 参数匹配的自定义属性,并指定是否搜索此类型的继承链;如果在此类型上未定义自定义属性,则为 nullAn array of objects containing the custom attributes defined in this type that match the attributeType parameter, specifying whether to search the type's inheritance chain, or null if no custom attributes are defined on this type.

异常

attributeTypenullattributeType is null.

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

适用于