public static OperatingSystemType FromName(string osName) { foreach (OperatingSystemType operatingSystemType in OperatingSystemType.Values()) { if (operatingSystemType.Name().Equals(osName)) { return(operatingSystemType); } } throw new ArgumentException(osName.ToString()); }
public static OperatingSystemType FromValue(int value) { foreach (OperatingSystemType operatingSystemType in OperatingSystemType.Values()) { if (operatingSystemType.Value().Equals(value)) { return(operatingSystemType); } } throw new ArgumentException(value.ToString()); }
public static List <OperatingSystemType> Values() { OperatingSystemType operatingSystemType = new OperatingSystemType(); List <OperatingSystemType> operatingSystemTypeList = new List <OperatingSystemType>(); foreach (FieldInfo field in operatingSystemType.GetType().GetFields()) { operatingSystemTypeList.Add((OperatingSystemType)field.GetValue((object)operatingSystemType)); } return(operatingSystemTypeList); }