Mono Class Library: System.Attribute Overview | Members

System.Attribute.GetCustomAttributes Method

Returns an array of the instances of a specified custom attribute if the attribute is in the metadata for the specified member.

public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element, Type type)

Parameters

element
An instance of a type derived from System.Reflection.MemberInfo that describes a type member.
type
The Type of the custom attribute for which to check.

Returns

An array of type type containing the instances that are applied to element. The array includes instances of type that are inherited by element, if any. Returns an empty array if the specified attribute was not found.

Exceptions

TypeReason
ArgumentNullExceptionelement or type is null.
ArgumentExceptiontype is not a type derived from Attribute.
NotSupportedExceptionelement does not represent a constructor, method, property, event, type, or field member.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0