// Generic method to convert enum datatype to select list items public static List < SelectListItem > GetEnumSelectListItems<T>() { List < SelectListItem > list = new List < SelectListItem >(); foreach (T type in Enum .GetValues( typeof (T))) { list.Add ( new SelectListItem () { Selected = false , Text = type.ToString(), Value = type.ToString() } ); } return list; }
Blog for sharing my programming experience and share my codes