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