public static AllocationModelType FromValue(string value) { foreach (AllocationModelType allocationModelType in AllocationModelType.Values()) { if (allocationModelType.Value().Equals(value)) { return(allocationModelType); } } throw new ArgumentException(value.ToString()); }
public static List <AllocationModelType> Values() { AllocationModelType allocationModelType = new AllocationModelType(); List <AllocationModelType> allocationModelTypeList = new List <AllocationModelType>(); foreach (FieldInfo field in allocationModelType.GetType().GetFields()) { allocationModelTypeList.Add((AllocationModelType)field.GetValue((object)allocationModelType)); } return(allocationModelTypeList); }