public static List <VMStatus> Values() { VMStatus vmStatus = new VMStatus(); List <VMStatus> vmStatusList = new List <VMStatus>(); foreach (FieldInfo field in vmStatus.GetType().GetFields()) { vmStatusList.Add((VMStatus)field.GetValue((object)vmStatus)); } return(vmStatusList); }
public static VMStatus FromValue(int value) { VMStatus vmStatus1 = new VMStatus(); foreach (FieldInfo field in vmStatus1.GetType().GetFields()) { VMStatus vmStatus2 = (VMStatus)field.GetValue((object)vmStatus1); if (vmStatus2.Value() == value) { return(vmStatus2); } } throw new ArgumentException(value.ToString()); }