Class Type<T>.Attribute<TAttribute>
Provides typed access to the type attribute.
Inherited Members
Namespace: DotNext.Reflection
Assembly: DotNext.Reflection.dll
Syntax
public static class Attribute<TAttribute>
where TAttribute : Attribute
Type Parameters
Name | Description |
---|---|
TAttribute | Type of attribute. |
Methods
| Improve this Doc View SourceGet(Boolean, Predicate<TAttribute>)
Returns attribute associated with the type T
.
Declaration
public static TAttribute Get(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | inherit | True to find inherited attribute. |
Predicate<TAttribute> | condition | Optional predicate to check attribute properties. |
Returns
Type | Description |
---|---|
TAttribute | Attribute associated with type |
GetAll(Boolean, Predicate<TAttribute>)
Get all custom attributes of type TAttribute
.
Declaration
public static IEnumerable<TAttribute> GetAll(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | inherit | True to find inherited attribute. |
Predicate<TAttribute> | condition | Optional predicate to check attribute properties. |
Returns
Type | Description |
---|---|
IEnumerable<TAttribute> | All attributes associated with type |
Require(Boolean, Predicate<TAttribute>)
Returns attribute associated with the type T
.
Declaration
public static TAttribute Require(bool inherit = false, Predicate<TAttribute> condition = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | inherit | True to find inherited attribute. |
Predicate<TAttribute> | condition | Optional predicate to check attribute properties. |
Returns
Type | Description |
---|---|
TAttribute | Attribute associated with type |
Exceptions
Type | Condition |
---|---|
MissingAttributeException | Event doesn't exist. |