I have this Enum
public enum Genders
{
[Description("Nữ")]
Female,
[Description("Nam")]
Male
}
I use this code to get each Enum name and value and save it to an Dictionary The result is
Female : 0
Male :1
accountViewModel.Genders = Enum.GetValues(typeof(Account.Genders))
.Cast<Account.Genders>()
.ToDictionary(t => t.ToString(), t => (int)t);
How to mofify above code to get each Enum's Description and it value ?
Like this.
Nữ : 0
Nam : 1