MemberInfo::GetCustomAttributes Method (Boolean)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Parameters
- inherit
- Type: System::Boolean
true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events; see Remarks
Return Value
Type: array<System::Object>An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
Implements
ICustomAttributeProvider::GetCustomAttributes(Boolean)| Exception | Condition |
|---|---|
| TypeLoadException | A custom attribute type could not be loaded. |
This method ignores the inherit parameter for properties and events. To search the inheritance chain for attributes on properties and events, use the appropriate overloads of the Attribute::GetCustomAttributes method.
Platform Notes
Silverlight for Windows Phone
The following example defines a custom attribute and associates the attribute with MyClass.MyMethod, retrieves the attribute at run time, and displays the result.
Note: |
|---|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Note: