public static IEnumerable <TextValuePair> GetEnumDescriptionValues(Type enumType) { var enums = new List <TextValuePair>(); foreach (System.Enum item in System.Enum.GetValues(enumType)) { var e = new TextValuePair() { Text = GetDescriptions(item).FirstOrDefault(), Value = Convert.ToInt32(item).ToString() }; enums.Add(e); } return(enums); }
public static IEnumerable <TextValuePair> GetEnumTextValues(Type enumType) { var enums = new List <TextValuePair>(); foreach (System.Enum item in System.Enum.GetValues(enumType)) { var e = new TextValuePair() { Text = System.Enum.GetName(enumType, item), Value = Convert.ToInt32(item).ToString() }; enums.Add(e); } return(enums); }