public Unit(T type, Unit unitToConvert) { if (!UnitDimensions.HaveSameDimensions(type.Dimensions, unitToConvert.Dimensions)) { throw new Exception("Units do not have the same Dimensions"); } this.UnitType = type; this.Measurement = unitToConvert.MeasurementIn(type); }
protected static bool _HaveTheSameDimensions(Unit unit1, Unit unit2) { return(UnitDimensions.HaveSameDimensions(unit1.UnitType.Dimensions, unit2.UnitType.Dimensions)); }