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