Edit

Share via


DynamicMethod.GetCustomAttributes Method

Definition

Returns the custom attributes applied to the method.

Overloads

GetCustomAttributes(Boolean)

Returns all the custom attributes defined for the method.

GetCustomAttributes(Type, Boolean)

Returns the custom attributes of the specified type that have been applied to the method.

GetCustomAttributes(Boolean)

Source:
DynamicMethod.cs
Source:
DynamicMethod.cs
Source:
DynamicMethod.cs

Returns all the custom attributes defined for the method.

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

true to search the method's inheritance chain to find the custom attributes; false to check only the current method.

Returns

Object[]

An array of objects representing all the custom attributes of the method.

Remarks

For dynamic methods, specifying true for inherit has no effect, because the method is not declared in a type.

Note

Custom attributes are not currently supported on dynamic methods. The only attribute returned is MethodImplAttribute; you can get the method implementation flags more easily using the GetMethodImplementationFlags method.

See also

Applies to

GetCustomAttributes(Type, Boolean)

Source:
DynamicMethod.cs
Source:
DynamicMethod.cs
Source:
DynamicMethod.cs

Returns the custom attributes of the specified type that have been applied to the method.

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

A Type representing the type of custom attribute to return.

inherit
Boolean

true to search the method's inheritance chain to find the custom attributes; false to check only the current method.

Returns

Object[]

An array of objects representing the attributes of the method that are of type attributeType or derive from type attributeType.

Exceptions

attributeType is null.

Remarks

For dynamic methods, specifying true for inherit has no effect, because the method is not declared in a type.

Note

Custom attributes are not currently supported on dynamic methods. The only attribute returned is MethodImplAttribute; you can get the method implementation flags more easily using the GetMethodImplementationFlags method.

See also

Applies to