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