EnumHelperGetAttributeOfTypeT Method
Gets an attribute on an enum field value
Namespace: Scopos.BabelFish.HelpersAssembly: BabelFish (in BabelFish.dll) Version: 1.12.5.15+bc7490f802416c9e774304c66372b6a26afede1d
public static T GetAttributeOfType<T>(
this Enum enumVal
)
where T : Attribute
- enumVal Enum
- The enum value
- T
- The type of the attribute you want to retrieve
TThe attribute of type T that exists on the enum valueIn 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
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;