Thursday 12 December 2019

C#.NET - Reflection - Get Enum Description from Enum Value

/// Gets the description of the Enumeration provided.
public string GetEnumDescription(Enum value) { return value .GetType() .GetMember(value.ToString()) .FirstOrDefault() .GetCustomAttribute() ?.Description; }

No comments: