MemberInfo.GetCustomAttributes Method (Type, Boolean)
Assembly: mscorlib (in mscorlib.dll)
public: virtual array<Object^>^ GetCustomAttributes ( Type^ attributeType, bool inherit ) abstract
public abstract Object[] GetCustomAttributes ( Type attributeType, boolean inherit )
public abstract function GetCustomAttributes ( attributeType : Type, inherit : boolean ) : Object[]
Not applicable.
Parameters
- attributeType
The type of attribute to search for. Only attributes that are assignable to this type are returned.
- inherit
Specifies whether to search this member's inheritance chain to find the attributes.
Return Value
An array of custom attributes applied to this member, or an array with zero (0) elements if no attributes have been applied.| Exception type | Condition |
|---|---|
| A custom attribute type cannot be loaded. | |
| If attributeType is a null reference (Nothing in Visual Basic). | |
| This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection Only Context. |
Note: |
|---|
| In the .NET Framework version 2.0, this method returns security attributes on methods, constructors, and types if the attributes are stored in the new metadata format. Assemblies compiled with version 2.0 use this format. Dynamic assemblies and assemblies compiled with earlier versions of the .NET Framework use the old XML format. See Emitting Declarative Security Attributes. |
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: