Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Attribute.GetCustomAttributes Method (ParameterInfo, Type, Boolean)

.NET Framework 1.1

Retrieves an array of the custom attributes of a specified type applied to a specified parameter of a member of a class or optionally inherited from a base class.

[Visual Basic]
Overloads Public Shared Function GetCustomAttributes( _
   ByVal element As ParameterInfo, _
   ByVal attributeType As Type, _
   ByVal inherit As Boolean _
) As Attribute()
public static Attribute[] GetCustomAttributes(
 ParameterInfo element,
 Type attributeType,
 bool inherit
public: static Attribute* GetCustomAttributes(
 ParameterInfo* element,
 Type* attributeType,
 bool inherit
) [];
public static function GetCustomAttributes(
   element : ParameterInfo,
 attributeType : Type,
 inherit : Boolean
) : Attribute[];


An object derived from class ParameterInfo that describes a parameter of a member of a class.
The Type object to which the custom attributes are applied.
If true, specifies to also search the ancestors of element for custom attributes.

Return Value

An Attribute array containing the custom attributes of type attributeType applied to element.


An empty array if no such custom attributes exist.


Exception Type Condition
ArgumentNullException element or attributeType is a null reference (Nothing in Visual Basic).
ArgumentException attributeType is not derived from Attribute.


Return value contains the custom attributes for ancestors of element if inherit is true.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Attribute Class | Attribute Members | System Namespace | Attribute.GetCustomAttributes Overload List

© 2015 Microsoft