TypeBuilder.GetCustomAttributes TypeBuilder.GetCustomAttributes TypeBuilder.GetCustomAttributes TypeBuilder.GetCustomAttributes Method

定义

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

重载

GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean)

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

GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean)

返回当前类型的所有自定义属性,该属性可分配给指定类型。Returns all the custom attributes of the current type that are assignable to a specified type.

GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean) GetCustomAttributes(Boolean)

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

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 Boolean Boolean Boolean

指定是否搜索此成员的继承链以查找属性。Specifies whether to search this member's inheritance chain to find the attributes.

返回

Object[]

返回一个对象数组,其中的对象表示此类型的所有自定义属性。Returns an array of objects representing all the custom attributes of this type.

异常

不完整类型目前不支持此方法。This method is not currently supported for incomplete types. 使用 GetType() 检索此类型,并对返回的 Type 调用 GetCustomAttributes(Boolean)Retrieve the type using GetType() and call GetCustomAttributes(Boolean) on the returned Type.

GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean) GetCustomAttributes(Type, Boolean)

返回当前类型的所有自定义属性,该属性可分配给指定类型。Returns all the custom attributes of the current type that are assignable to a specified 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 Type Type Type

要搜索的属性的类型。The type of attribute to search for. 仅返回可分配给此类型的属性。Only attributes that are assignable to this type are returned.

inherit
Boolean Boolean Boolean Boolean

指定是否搜索此成员的继承链以查找属性。Specifies whether to search this member's inheritance chain to find the attributes.

返回

Object[]

在当前类型上定义的自定义属性数组。An array of custom attributes defined on the current type.

异常

不完整类型目前不支持此方法。This method is not currently supported for incomplete types. 使用 GetType() 检索此类型,并对返回的 Type 调用 GetCustomAttributes(Boolean)Retrieve the type using GetType() and call GetCustomAttributes(Boolean) on the returned Type.

该类型必须是由基础运行时系统提供的类型。The type must be a type provided by the underlying runtime system.

适用于