In this section, I’ll talk about ToDescription<T> extension method. This method used get enum description from enum value.
1. Add reference to Cinchoo.Core.ExtensionMethods.dll assembly
2. Namespace System
Sample:
public enum Color { [Description("Red Color")] Red, [Description("Green Color")] Green, [Description("Yellow Color")] Yellow } static void Main(string[] args) { Console.Write("Description of 'Color.Green' enum value is: "); Console.WriteLine(Color.Green.ToDescription()); }
When you run the above code, the output will be
Description of 'Color.Green' enum value is: Green Color Press any key to continue . . .
Happy coding!!!
Image may be NSFW.
Clik here to view.

Clik here to view.
