-
Notifications
You must be signed in to change notification settings - Fork 1
net90_PropertyGridHelpers.Support_Support_GetFirstCustomAttribute
dparvin edited this page Jun 29, 2025
·
1 revision
Retrieves the first custom attribute of the specified type applied to the given MemberInfo.
public static T GetFirstCustomAttribute<T>(MemberInfo member)
where T : Attribute| parameter | description |
|---|---|
| T | The type of attribute to retrieve. Must derive from Attribute. |
| member | The member (e.g., property, method, field, type) to inspect for the attribute. |
An instance of the attribute type T if one is defined on the member; otherwise, null.
| exception | condition |
|---|---|
| ArgumentNullException | Thrown if member is null. |
On .NET Framework 3.5, this uses Boolean) internally; on later versions, it uses Boolean).
Example usage:
var property = typeof(MyClass).GetProperty("MyProperty");
var attr = Support.GetFirstCustomAttribute<AutoCompleteSetupAttribute>(property);
if (attr != null)
{
// Attribute was found
}- class Support
- namespace PropertyGridHelpers.Support
- assembly PropertyGridHelpers