How to get Enum display name

Viewed 128

I have an emun defined as in the sample below.

 public enum SampleEnum : int
{
    [Display(Name = "One")]
    Test_One = 1,
    [Display(Name = "Two")]
    Test_Two = 2,
    [Display(Name = "Three")]
    Test_Three = 3

}

In the below line of code, how can get the Display instead name?

   var displayName = Enum.GetName(typeof(SampleEnum ), 2); 

In the above line, i would like to get Two instead of Test_Two

1 Answers
Related