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 parameter.

public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element, Type attributeType)

Parameters

element
A System.Reflection.ParameterInfo instance.
attributeType
The Type of the custom attribute for which to check.

Returns

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

Exceptions

TypeReason
ArgumentNullExceptionelement or attributeType is null.
ArgumentExceptionattributeType is not a type derived from Attribute.

Remarks

If element represents a method parameter, the array returned by Attribute.GetCustomAttributes(System.Reflection.MemberInfo, Type) includes any attributeType instances for the parameter element in the base methods.

Requirements

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