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