ExtensionMethodsGetDescriptionT Method |
Get the Description of an
Enum value, if that enumeration value is marked by DescriptionAttribute
Namespace:
Hummingbird.TestFramework
Assembly:
Hummingbird.TestFramework (in Hummingbird.TestFramework.dll) Version: 1.2.0.0
Syntax public static string GetDescription<T>(
this T enumerationValue
)
where T : struct, new()
<ExtensionAttribute>
Public Shared Function GetDescription(Of T As {Structure, New}) (
enumerationValue As T
) As String
public:
[ExtensionAttribute]
generic<typename T>
where T : value class, gcnew()
static String^ GetDescription(
T enumerationValue
)
[<ExtensionAttribute>]
static member GetDescription :
enumerationValue : 'T -> string when 'T : struct, new()
Parameters
- enumerationValue
- Type: T
value
Type Parameters
- T
- Type of the enumeration
Return Value
Type:
StringThe description of an Enum object.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Examples
public enum Versions {
[Description("1.0")]
Version10
}
See Also