private System.ComponentModel.BindingList<ListItem> EnumToList(Type enumType)
{
System.ComponentModel.BindingList<ListItem> listItemBindingList = new System.ComponentModel.BindingList<ListItem>();
foreach (Enum item in Enum.GetValues(enumType))
{
ListItem lItem = new ListItem(item.ToString("D"), item.ToString("G"));
listItemBindingList.Add(lItem);
}
}
you can call the method
BindingList<ListItem> listItemBindingList = EnumToList(typeof(YourEnum));
{
System.ComponentModel.BindingList<ListItem> listItemBindingList = new System.ComponentModel.BindingList<ListItem>();
foreach (Enum item in Enum.GetValues(enumType))
{
ListItem lItem = new ListItem(item.ToString("D"), item.ToString("G"));
listItemBindingList.Add(lItem);
}
}
you can call the method
BindingList<ListItem> listItemBindingList = EnumToList(typeof(YourEnum));
Comments