Επεξεργασία

Κοινή χρήση μέσω


TypeBuilder.GetCustomAttributes Method

Definition

Returns the custom attributes defined for this type.

Overloads

GetCustomAttributes(Boolean)

Returns all the custom attributes defined for this type.

GetCustomAttributes(Type, Boolean)

Returns all the custom attributes of the current type that are assignable to a specified type.

GetCustomAttributes(Boolean)

Source:
TypeBuilder.cs

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()

Parameters

inherit
Boolean

Specifies whether to search this member's inheritance chain to find the attributes.

Returns

Object[]

Returns an array of objects representing all the custom attributes of this type.

Exceptions

This method is not currently supported for incomplete types. Retrieve the type using GetType() and call GetCustomAttributes(Boolean) on the returned Type.

Applies to

GetCustomAttributes(Type, Boolean)

Source:
TypeBuilder.cs

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()

Parameters

attributeType
Type

The type of attribute to search for. Only attributes that are assignable to this type are returned.

inherit
Boolean

Specifies whether to search this member's inheritance chain to find the attributes.

Returns

Object[]

An array of custom attributes defined on the current type.

Exceptions

This method is not currently supported for incomplete types. Retrieve the type using GetType() and call GetCustomAttributes(Boolean) on the returned Type.

attributeType is null.

The type must be a type provided by the underlying runtime system.

Applies to