Cadenza : Cadenza.Reflection Namespace

CustomAttributeProviderCoda Class

Extension methods for System.Reflection.ICustomAttributeProvider.

public static class CustomAttributeProviderCoda

⊟ Remarks

⊟ Requirements

Namespace: Cadenza.Reflection
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

⊟ Members

See Also: Inherited members from object.

⊟ Public Methods

static
GetCustomAttribute<TAttribute> (this System.Reflection.ICustomAttributeProvider) : TAttribute
Retrieves a custom attribute of type TAttribute.
static
GetCustomAttributes<TAttribute> (this System.Reflection.ICustomAttributeProvider) : TAttribute[]
Retrieves all custom attributes of type TAttribute.

⊟ Member Details

⊟ GetCustomAttribute<TAttribute> Generic Method

Retrieves a custom attribute of type TAttribute.

public static TAttribute GetCustomAttribute<TAttribute> (this System.Reflection.ICustomAttributeProvider self)
where TAttribute : Attribute

⊟ Type Parameters

TAttribute
The type of the custom attribute to return.

⊟ Parameters

self
A System.Reflection.ICustomAttributeProvider from which to retrieve a custom attribute of type TAttribute.

⊟ Returns

Returns the first custom attribute of type TAttribute or null if no type parameters of type TAttribute are available.

⊟ Exceptions

Type Reason
ArgumentNullException self is null.

⊟ Remarks

C# Example
FooAttribute foo = typeof (Bar).GetCustomAttribute<FooAttribute> ();

⊟ Requirements

Namespace: Cadenza.Reflection
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

⊟ GetCustomAttributes<TAttribute> Generic Method

Retrieves all custom attributes of type TAttribute.

public static TAttribute[] GetCustomAttributes<TAttribute> (this System.Reflection.ICustomAttributeProvider self)
where TAttribute : Attribute

⊟ Type Parameters

TAttribute
The type of the custom attribute to return.

⊟ Parameters

self
A System.Reflection.ICustomAttributeProvider from which to retrieve custom attributes of type TAttribute.

⊟ Returns

Returns all custom attributes of type TAttribute or an empty array if no type parameters of type TAttribute are available.

⊟ Exceptions

Type Reason
ArgumentNullException self is null.

⊟ Remarks

C# Example
var attributes = typeof (Bar).GetCustomAttributes<FooAttribute> ();

⊟ Requirements

Namespace: Cadenza.Reflection
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0