public static IEnumerable<String> FillList(PropertyDescription myPropertyDescription, Type myType) { var _List = new List<String>(); for (int i = 0; i < myPropertyDescription.NumElements; i++) { var enumName = Enum.GetName(myType, myPropertyDescription.PropDesc[i]); if (enumName != null) { var _Enum = (Enum) Enum.Parse(myType, enumName); _List.Add(EnumHelper.GetDescriptionAttribute(_Enum)); } } return _List; }
public static IEnumerable<KeyValuePair<String, String>> FillMap(PropertyDescription myPropertyDescription, Type myType) { var _Map = new List<KeyValuePair<String, String>>(); for (int i = 0; i < myPropertyDescription.NumElements; i++) { var enumName = Enum.GetName(myType, myPropertyDescription.PropDesc[i]); if (enumName != null) { Enum en = (Enum) Enum.Parse(myType, enumName); _Map.Add(new KeyValuePair<String, String>(en.ToString(), EnumHelper.GetDescriptionAttribute(en))); } } return _Map; }