EnumHelperGetAttributeOfTypeT Method
Gets an attribute on an enum field value
Namespace: Scopos.BabelFish.HelpersAssembly: BabelFish (in BabelFish.dll) Version: 1.11.1.4+b1da393815f6638555a663d9a94167ecabea5695
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;