public static DigitalStorageValue Parse(string value, string unit) { unit = unit.ToUpper(); if (!Enum.TryParse(unit, out DigitalStorageUnit parsedUnit)) { throw new ArgumentException("Unit " + unit + " could not be parsed."); } if (!int.TryParse(value, out int parsedValue)) { throw new ArgumentException("Value " + value + " could not be parsed."); } return(new DigitalStorageValue(parsedValue, parsedUnit)); }
public DigitalStorageValue(int value, DigitalStorageUnit unit) { this.value = value; this.unit = unit; }