Uređivanje

Dijeli putem


ICustomAttributeProvider.GetCustomAttributes Method

Definition

Returns custom attributes defined on this member.

Overloads

GetCustomAttributes(Boolean)

Returns an array of all of the custom attributes defined on this member, excluding named attributes, or an empty array if there are no custom attributes.

GetCustomAttributes(Type, Boolean)

Returns an array of custom attributes defined on this member, identified by type, or an empty array if there are no custom attributes of that type.

GetCustomAttributes(Boolean)

Returns an array of all of the custom attributes defined on this member, excluding named attributes, or an empty array if there are no custom attributes.

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

Parameters

inherit
Boolean

When true, look up the hierarchy chain for the inherited custom attribute.

Returns

Object[]

An array of Objects representing custom attributes, or an empty array.

Exceptions

The custom attribute type cannot be loaded.

There is more than one attribute of type attributeType defined on this member.

Remarks

Calling ICustomAttributeProvider.GetCustomAttributes on PropertyInfo or EventInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. Use System.Attribute to inherit custom attributes.

This method returns custom attributes defined directly on a non-inherited member only.

Applies to

GetCustomAttributes(Type, Boolean)

Returns an array of custom attributes defined on this member, identified by type, or an empty array if there are no custom attributes of that type.

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

Parameters

attributeType
Type

The type of the custom attributes.

inherit
Boolean

When true, look up the hierarchy chain for the inherited custom attribute.

Returns

Object[]

An array of Objects representing custom attributes, or an empty array.

Exceptions

The custom attribute type cannot be loaded.

attributeType is null.

Remarks

If attributeType is a base class or interface, this method returns any implementation of that type.

This method returns custom attributes defined directly on a non-inherited member only.

Calling ICustomAttributeProvider.GetCustomAttributes on PropertyInfo or EventInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. Use System.Attribute to inherit custom attributes.

Applies to