Extension Methods for retrieving a value from an attribute

Namespace: Nehta.VendorLibrary.Common
Assembly: Nehta.VendorLibrary.Common (in Nehta.VendorLibrary.Common.dll) Version: 3.0.2.0 (1.0.0.0)

Syntax

C#
public static TExpected GetAttributeValue<T, TExpected>(
	this Enum enumeration,
	Func<T, TExpected> expression
)
where T : Attribute
Visual Basic
<ExtensionAttribute> _
Public Shared Function GetAttributeValue(Of T As Attribute, TExpected) ( _
	enumeration As Enum, _
	expression As Func(Of T, TExpected) _
) As TExpected
Visual C++
[ExtensionAttribute]
public:
generic<typename T, typename TExpected>
where T : Attribute
static TExpected GetAttributeValue(
	Enum^ enumeration, 
	Func<T, TExpected>^ expression
)

Parameters

enumeration
Type: System..::..Enum
The enum type that this method extends
expression
Type: System..::..Func<(Of <(<'T, TExpected>)>)>
An expression specifying the property on the attribute you would like to retrun

Type Parameters

T
The object / attribute type
TExpected
The expected return value type

Return Value

The value as specified by the expression parameter

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Enum. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also