public static void FillEnumListControl(ListControl list, Type enumType) { foreach (DictionaryEntry entry in DynamicDataFutures.GetEnumNamesAndValues(enumType)) { list.Items.Add(new ListItem((string)entry.Key, (string)entry.Value)); } }
private static IOrderedDictionary GetEnumNamesAndValues(Type enumType) { OrderedDictionary result = new OrderedDictionary(); foreach (object enumValue in Enum.GetValues(enumType)) { // TODO: add way to localize the displayed name string name = Enum.GetName(enumType, enumValue); string value = DynamicDataFutures.GetUnderlyingTypeValueString(enumType, enumValue); result.Add(name, value); } return(result); }