0

How to convert enum into a List in C#

public enum PaymentType
{
    [Description("Direct Debit")] DD,
    [Description("EFT")] EFT,
    [Description("Live Check")] LCk,
    [Description("Other")] Other,
    [Description("None")] None
}

The above is my Enum, I have tried the below code for converting this into List

var allEnum = Enum.GetValues(typeof(PaymentType)).Cast<PaymentType>().ToList();

and it's generating the result like this

0 DD
1 EFT
2 LCk
3 Other
4 None

but I want this to be like

DD Direct Debit
EFT EFT
LCk Live Check
Other Other
None None
GSerg
  • 76,472
  • 17
  • 159
  • 346

0 Answers0