Method GetAttribute
GetAttribute<TAttribute>(Type, bool)
Gets the first attribute of a given type.
Declaration
public static TAttribute GetAttribute<TAttribute>(this Type type, bool inherit = false) where TAttribute : Attribute
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | The type whose attribute will be returned. |
| bool | inherit | Whether to search this type's inheritance chain to find the attribute. |
Returns
| Type | Description |
|---|---|
| TAttribute | The first |
Type Parameters
| Name | Description |
|---|---|
| TAttribute | Attribute type to return. |