示例#1
0
        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);
        }
示例#2
0
        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());
        }