diff --git a/UnitsNet.Tests/BaseUnitsTests.cs b/UnitsNet.Tests/BaseUnitsTests.cs index 698418b95c..3954e61b93 100644 --- a/UnitsNet.Tests/BaseUnitsTests.cs +++ b/UnitsNet.Tests/BaseUnitsTests.cs @@ -136,5 +136,45 @@ public void ToStringGivesExpectedResult() Assert.Equal("[Length]: m, [Mass]: kg, [Time]: s, [Current]: A, [Temperature]: K, [Amount]: mol, [LuminousIntensity]: cd", siBaseUnits.ToString()); } + + [Fact] + public void IsFullyDefined_TrueIfAllBaseUnitDefined() + { + Assert.True(new BaseUnits(LengthUnit.Meter, MassUnit.Kilogram, DurationUnit.Second, + ElectricCurrentUnit.Ampere, TemperatureUnit.Kelvin, AmountOfSubstanceUnit.Mole, + LuminousIntensityUnit.Candela).IsFullyDefined); + } + + [Fact] + public void IsFullyDefined_FalseIfAnyBaseUnitIsUndefined() + { + Assert.False(new BaseUnits(mass: MassUnit.Kilogram, time: DurationUnit.Second, + current: ElectricCurrentUnit.Ampere, temperature: TemperatureUnit.Kelvin, amount: AmountOfSubstanceUnit.Mole, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, time: DurationUnit.Second, + current: ElectricCurrentUnit.Ampere, temperature: TemperatureUnit.Kelvin, amount: AmountOfSubstanceUnit.Mole, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, + current: ElectricCurrentUnit.Ampere, temperature: TemperatureUnit.Kelvin, amount: AmountOfSubstanceUnit.Mole, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, + temperature: TemperatureUnit.Kelvin, amount: AmountOfSubstanceUnit.Mole, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, + current: ElectricCurrentUnit.Ampere, amount: AmountOfSubstanceUnit.Mole, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, + current: ElectricCurrentUnit.Ampere, temperature: TemperatureUnit.Kelvin, + luminousIntensity: LuminousIntensityUnit.Candela).IsFullyDefined); + + Assert.False(new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second, + current: ElectricCurrentUnit.Ampere, temperature: TemperatureUnit.Kelvin, amount: AmountOfSubstanceUnit.Mole + ).IsFullyDefined); + } } } diff --git a/UnitsNet.Tests/CustomCode/AreaTests.cs b/UnitsNet.Tests/CustomCode/AreaTests.cs index b3db19ebca..85fe8fee1a 100644 --- a/UnitsNet.Tests/CustomCode/AreaTests.cs +++ b/UnitsNet.Tests/CustomCode/AreaTests.cs @@ -90,5 +90,19 @@ public void Constructor_UnitSystemSI_AssignsSIUnit() var area = new Area(1.0, UnitSystem.SI); Assert.Equal(AreaUnit.SquareMeter, area.Unit); } + + [Fact] + public void As_ImperialGivenSIUnitSystem_ReturnsSIValue() + { + var imperialArea = new Area(2.0, AreaUnit.SquareInch); + Assert.Equal(0.00129032, imperialArea.As(UnitSystem.SI)); + } + + [Fact] + public void ToUnit_ImperialGivenSIUnitSystem_ReturnsSIValue() + { + var imperialArea = new Area(2.0, AreaUnit.SquareInch); + Assert.Equal(Area.FromSquareMeters(0.00129032), imperialArea.ToUnit(UnitSystem.SI)); + } } } diff --git a/UnitsNet.Tests/CustomCode/EnergyTests.cs b/UnitsNet.Tests/CustomCode/EnergyTests.cs index 8a8a420437..3f99aec9df 100644 --- a/UnitsNet.Tests/CustomCode/EnergyTests.cs +++ b/UnitsNet.Tests/CustomCode/EnergyTests.cs @@ -60,5 +60,19 @@ public void Constructor_UnitSystemSI_AssignsSIUnit() var energy = new Energy(1.0, UnitSystem.SI); Assert.Equal(EnergyUnit.Joule, energy.Unit); } + + [Fact] + public void As_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + var imperialEnergy = new Energy(2.0, EnergyUnit.BritishThermalUnit); + Assert.Equal(2110.11170524, imperialEnergy.As(UnitSystem.SI)); + } + + [Fact] + public void ToUnit_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + var imperialEnergy = new Energy(2.0, EnergyUnit.BritishThermalUnit); + Assert.Equal(Energy.FromJoules(2110.11170524), imperialEnergy.ToUnit(UnitSystem.SI)); + } } } diff --git a/UnitsNet.Tests/CustomCode/LengthTests.cs b/UnitsNet.Tests/CustomCode/LengthTests.cs index 0634c931f4..ec54147c2f 100644 --- a/UnitsNet.Tests/CustomCode/LengthTests.cs +++ b/UnitsNet.Tests/CustomCode/LengthTests.cs @@ -165,5 +165,19 @@ public void Constructor_UnitSystemSI_AssignsSIUnit() var length = new Length(1.0, UnitSystem.SI); Assert.Equal(LengthUnit.Meter, length.Unit); } + + [Fact] + public void As_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + var imperialLength = new Length(2.0, LengthUnit.Inch); + Assert.Equal(0.0508, imperialLength.As(UnitSystem.SI)); + } + + [Fact] + public void ToUnit_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + var imperialLength = new Length(2.0, LengthUnit.Inch); + Assert.Equal(Length.FromMeters(0.0508), imperialLength.ToUnit(UnitSystem.SI)); + } } } diff --git a/UnitsNet.Tests/IQuantityTests.cs b/UnitsNet.Tests/IQuantityTests.cs index 1e2a91d1d6..382cd25bb2 100644 --- a/UnitsNet.Tests/IQuantityTests.cs +++ b/UnitsNet.Tests/IQuantityTests.cs @@ -16,11 +16,39 @@ public void As_GivenWrongUnitType_ThrowsArgumentException() Assert.Throws(() => length.As(MassUnit.Kilogram)); } + [Fact] + public void As_GivenNullUnitSystem_ThrowsArgumentNullException() + { + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + Assert.Throws(() => imperialLengthQuantity.As((UnitSystem)null)); + } + + [Fact] + public void As_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + Assert.Equal(0.0508, imperialLengthQuantity.As(UnitSystem.SI)); + } + [Fact] public void ToUnit_GivenWrongUnitType_ThrowsArgumentException() { IQuantity length = Length.FromMeters(1.2345); Assert.Throws(() => length.ToUnit(MassUnit.Kilogram)); } + + [Fact] + public void ToUnit_GivenNullUnitSystem_ThrowsArgumentNullException() + { + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + Assert.Throws(() => imperialLengthQuantity.ToUnit((UnitSystem)null)); + } + + [Fact] + public void ToUnit_ImperialQuantityGivenSIUnitSystem_ReturnsSIValue() + { + IQuantity imperialLengthQuantity = new Length(2.0, LengthUnit.Inch); + Assert.Equal(Length.FromMeters(0.0508), imperialLengthQuantity.ToUnit(UnitSystem.SI)); + } } } diff --git a/UnitsNet/BaseUnits.cs b/UnitsNet/BaseUnits.cs index 0148b48b30..cfcf559eb1 100644 --- a/UnitsNet/BaseUnits.cs +++ b/UnitsNet/BaseUnits.cs @@ -46,6 +46,14 @@ public BaseUnits( Temperature = temperature; Amount = amount; LuminousIntensity = luminousIntensity; + + IsFullyDefined = Length != LengthUnit.Undefined && + Mass != MassUnit.Undefined && + Time != DurationUnit.Undefined && + Current != ElectricCurrentUnit.Undefined && + Temperature != TemperatureUnit.Undefined && + Amount != AmountOfSubstanceUnit.Undefined && + LuminousIntensity != LuminousIntensityUnit.Undefined; } /// @@ -181,5 +189,10 @@ public override string ToString() /// Gets the luminous intensity unit (J). /// public LuminousIntensityUnit LuminousIntensity{ get; } + + /// + /// Gets whether or not all of the base units are defined. + /// + public bool IsFullyDefined { get; } } } diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs index 8b2f9bfaae..f2a6af8222 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.NetFramework.g.cs @@ -736,6 +736,16 @@ public double As(AccelerationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -764,9 +774,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAccelerationUnit); } + /// + public Acceleration ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs index 66aa015af7..54bca9e3d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.NetFramework.g.cs @@ -766,6 +766,16 @@ public double As(AmountOfSubstanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -794,9 +804,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAmountOfSubstanceUnit); } + /// + public AmountOfSubstance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs index 7059ba51b2..c5bcdeb8ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.NetFramework.g.cs @@ -609,6 +609,16 @@ public double As(AmplitudeRatioUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -637,9 +647,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAmplitudeRatioUnit); } + /// + public AmplitudeRatio ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs index 398e3d23c2..b7ae67c111 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.NetFramework.g.cs @@ -751,6 +751,16 @@ public double As(AngleUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -779,9 +789,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAngleUnit); } + /// + public Angle ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs index adb531a510..be5084ee71 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(ApparentEnergyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsApparentEnergyUnit); } + /// + public ApparentEnergy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ApparentEnergyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs index 7a2e29efa3..87c9f2d59f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.NetFramework.g.cs @@ -601,6 +601,16 @@ public double As(ApparentPowerUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -629,9 +639,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsApparentPowerUnit); } + /// + public ApparentPower ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ApparentPowerUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs index 1454a3bb36..e5bd3d7931 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.NetFramework.g.cs @@ -736,6 +736,16 @@ public double As(AreaUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -764,9 +774,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAreaUnit); } + /// + public Area ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs index 5bb00408a8..9c809fa1ad 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.NetFramework.g.cs @@ -556,6 +556,16 @@ public double As(AreaDensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -584,9 +594,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAreaDensityUnit); } + /// + public AreaDensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs index 45299eddf3..efea7f32f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.NetFramework.g.cs @@ -631,6 +631,16 @@ public double As(AreaMomentOfInertiaUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -659,9 +669,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsAreaMomentOfInertiaUnit); } + /// + public AreaMomentOfInertia ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs index 4d99ce759e..a2c71641d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.NetFramework.g.cs @@ -936,6 +936,16 @@ public double As(BitRateUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -964,9 +974,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsBitRateUnit); } + /// + public BitRate ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs index 2015220a4f..54956e85c4 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(BrakeSpecificFuelConsumptionUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsBrakeSpecificFuelConsumptionUnit); } + /// + public BrakeSpecificFuelConsumption ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs index f6011d3287..1695a559fe 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.NetFramework.g.cs @@ -649,6 +649,16 @@ public double As(CapacitanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -677,9 +687,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsCapacitanceUnit); } + /// + public Capacitance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(CapacitanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs index 6fe65d47f4..863527ea61 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(CoefficientOfThermalExpansionUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsCoefficientOfThermalExpansionUnit); } + /// + public CoefficientOfThermalExpansion ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs index 0a1280a34a..2bc80035f6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.NetFramework.g.cs @@ -1129,6 +1129,16 @@ public double As(DensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1157,9 +1167,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsDensityUnit); } + /// + public Density ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs index b506281ae5..29a2b9ef39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.NetFramework.g.cs @@ -691,6 +691,16 @@ public double As(DurationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -719,9 +729,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsDurationUnit); } + /// + public Duration ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs index 8a56deb711..4355267865 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.NetFramework.g.cs @@ -634,6 +634,16 @@ public double As(DynamicViscosityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -662,9 +672,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsDynamicViscosityUnit); } + /// + public DynamicViscosity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs index 74808cb923..900ac80304 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.NetFramework.g.cs @@ -601,6 +601,16 @@ public double As(ElectricAdmittanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -629,9 +639,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricAdmittanceUnit); } + /// + public ElectricAdmittance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs index f5ab761e53..4ea2a2abba 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(ElectricChargeUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricChargeUnit); } + /// + public ElectricCharge ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs index 914c6e26f9..3c59c4b774 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(ElectricChargeDensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricChargeDensityUnit); } + /// + public ElectricChargeDensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs index a6012068ec..6e52d145a9 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.NetFramework.g.cs @@ -589,6 +589,16 @@ public double As(ElectricConductanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -617,9 +627,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricConductanceUnit); } + /// + public ElectricConductance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs index 97cd39356e..91fa0ad29d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(ElectricConductivityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricConductivityUnit); } + /// + public ElectricConductivity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs index ed9e0197f4..9a759dbf08 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.NetFramework.g.cs @@ -661,6 +661,16 @@ public double As(ElectricCurrentUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -689,9 +699,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricCurrentUnit); } + /// + public ElectricCurrent ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs index 5472043c7e..dae7db4ea2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(ElectricCurrentDensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricCurrentDensityUnit); } + /// + public ElectricCurrentDensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs index 661610d895..dd191f3363 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.NetFramework.g.cs @@ -556,6 +556,16 @@ public double As(ElectricCurrentGradientUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -584,9 +594,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricCurrentGradientUnit); } + /// + public ElectricCurrentGradient ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs index 2e2105a832..e2a3723bd4 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(ElectricFieldUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricFieldUnit); } + /// + public ElectricField ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs index 5648d72c8e..e5c4bc83e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.NetFramework.g.cs @@ -604,6 +604,16 @@ public double As(ElectricInductanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -632,9 +642,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricInductanceUnit); } + /// + public ElectricInductance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs index 3b9ca20b53..d58ad28cfd 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.NetFramework.g.cs @@ -616,6 +616,16 @@ public double As(ElectricPotentialUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -644,9 +654,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricPotentialUnit); } + /// + public ElectricPotential ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs index c8642e5aa7..a8f3c9c4c8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.NetFramework.g.cs @@ -616,6 +616,16 @@ public double As(ElectricPotentialAcUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -644,9 +654,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricPotentialAcUnit); } + /// + public ElectricPotentialAc ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricPotentialAcUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs index 539e0294f4..b5a9562658 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.NetFramework.g.cs @@ -616,6 +616,16 @@ public double As(ElectricPotentialDcUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -644,9 +654,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricPotentialDcUnit); } + /// + public ElectricPotentialDc ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricPotentialDcUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs index fa2f71b8d9..23e93a10a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.NetFramework.g.cs @@ -616,6 +616,16 @@ public double As(ElectricResistanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -644,9 +654,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricResistanceUnit); } + /// + public ElectricResistance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs index 819a37ed64..8a3eec54bf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.NetFramework.g.cs @@ -754,6 +754,16 @@ public double As(ElectricResistivityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -782,9 +792,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsElectricResistivityUnit); } + /// + public ElectricResistivity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs index cc9ff73c65..41cf80d0d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.NetFramework.g.cs @@ -886,6 +886,16 @@ public double As(EnergyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -914,9 +924,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsEnergyUnit); } + /// + public Energy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs index b0feaa1471..a30ee26ef4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.NetFramework.g.cs @@ -646,6 +646,16 @@ public double As(EntropyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -674,9 +684,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsEntropyUnit); } + /// + public Entropy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs index 0e156e1e6f..06f7b46b2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.NetFramework.g.cs @@ -736,6 +736,16 @@ public double As(ForceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -764,9 +774,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsForceUnit); } + /// + public Force ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs index 5f94b3b775..749b9d85e1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.NetFramework.g.cs @@ -706,6 +706,16 @@ public double As(ForceChangeRateUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -734,9 +744,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsForceChangeRateUnit); } + /// + public ForceChangeRate ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs index 5ce7908585..f6f9b959f5 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.NetFramework.g.cs @@ -676,6 +676,16 @@ public double As(ForcePerLengthUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -704,9 +714,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsForcePerLengthUnit); } + /// + public ForcePerLength ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs index 4c3af49c64..520a093d47 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.NetFramework.g.cs @@ -676,6 +676,16 @@ public double As(FrequencyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -704,9 +714,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsFrequencyUnit); } + /// + public Frequency ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs index 4ea7b3d4ec..11cc30407b 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs @@ -811,6 +811,16 @@ public double As(HeatFluxUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -839,9 +849,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsHeatFluxUnit); } + /// + public HeatFlux ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs index 455e206e6a..4a9ececd46 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.NetFramework.g.cs @@ -571,6 +571,16 @@ public double As(HeatTransferCoefficientUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -599,9 +609,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsHeatTransferCoefficientUnit); } + /// + public HeatTransferCoefficient ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs index 03068209cf..cd6e2bac47 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.NetFramework.g.cs @@ -604,6 +604,16 @@ public double As(IlluminanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -632,9 +642,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsIlluminanceUnit); } + /// + public Illuminance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs index 6f24d02884..7fc48b55e9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.NetFramework.g.cs @@ -933,6 +933,16 @@ public double As(InformationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -961,9 +971,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsInformationUnit); } + /// + public Information ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs index fbbb279d7b..16922f5b5f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.NetFramework.g.cs @@ -751,6 +751,16 @@ public double As(IrradianceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -779,9 +789,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsIrradianceUnit); } + /// + public Irradiance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs index 11bc89d2f6..67b4a8b0d8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.NetFramework.g.cs @@ -634,6 +634,16 @@ public double As(IrradiationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -662,9 +672,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsIrradiationUnit); } + /// + public Irradiation ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs index eb76c91baa..05df70d5c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.NetFramework.g.cs @@ -664,6 +664,16 @@ public double As(KinematicViscosityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -692,9 +702,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsKinematicViscosityUnit); } + /// + public KinematicViscosity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs index a9abed3de6..723c45a665 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.NetFramework.g.cs @@ -556,6 +556,16 @@ public double As(LapseRateUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -584,9 +594,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLapseRateUnit); } + /// + public LapseRate ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LapseRateUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs index 9f91a50bf1..d18ff4d489 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.NetFramework.g.cs @@ -871,6 +871,16 @@ public double As(LengthUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -899,9 +909,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLengthUnit); } + /// + public Length ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs index 085611f919..89dbae5294 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.NetFramework.g.cs @@ -579,6 +579,16 @@ public double As(LevelUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -607,9 +617,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLevelUnit); } + /// + public Level ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs index 1861f18f2f..6d79da7083 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.NetFramework.g.cs @@ -589,6 +589,16 @@ public double As(LinearDensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -617,9 +627,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLinearDensityUnit); } + /// + public LinearDensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs index d4b59caeb6..5d63e04fc2 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(LuminousFluxUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLuminousFluxUnit); } + /// + public LuminousFlux ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs index 6f3c5656f4..0cba858036 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(LuminousIntensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsLuminousIntensityUnit); } + /// + public LuminousIntensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs index a32bd2cc37..2afc8fcc1d 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.NetFramework.g.cs @@ -604,6 +604,16 @@ public double As(MagneticFieldUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -632,9 +642,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMagneticFieldUnit); } + /// + public MagneticField ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs index d84fbcecfa..34bb6039f1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(MagneticFluxUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMagneticFluxUnit); } + /// + public MagneticFlux ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs index 835e6daf37..18c9e89f69 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(MagnetizationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMagnetizationUnit); } + /// + public Magnetization ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs index 2e2d84bd18..d9fe22d3b0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.NetFramework.g.cs @@ -886,6 +886,16 @@ public double As(MassUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -914,9 +924,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMassUnit); } + /// + public Mass ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs index 1f853fd20c..5040d715a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.NetFramework.g.cs @@ -1006,6 +1006,16 @@ public double As(MassFlowUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1034,9 +1044,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMassFlowUnit); } + /// + public MassFlow ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs index 9a080c17b2..4747b10823 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.NetFramework.g.cs @@ -571,6 +571,16 @@ public double As(MassFluxUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -599,9 +609,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMassFluxUnit); } + /// + public MassFlux ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs index 3ebb5db9e3..a27c4bc844 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.NetFramework.g.cs @@ -961,6 +961,16 @@ public double As(MassMomentOfInertiaUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -989,9 +999,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMassMomentOfInertiaUnit); } + /// + public MassMomentOfInertia ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MassMomentOfInertiaUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs index f2b70bc69b..d819d5d80e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(MolarEnergyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMolarEnergyUnit); } + /// + public MolarEnergy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MolarEnergyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs index 5c083dcf44..e59e8dca16 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(MolarEntropyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMolarEntropyUnit); } + /// + public MolarEntropy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MolarEntropyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs index c3c50457ec..bd50f4c167 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.NetFramework.g.cs @@ -721,6 +721,16 @@ public double As(MolarMassUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -749,9 +759,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMolarMassUnit); } + /// + public MolarMass ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MolarMassUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs index 2e25137e8f..d10a7ad1ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.NetFramework.g.cs @@ -664,6 +664,16 @@ public double As(MolarityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -692,9 +702,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsMolarityUnit); } + /// + public Molarity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(MolarityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs index 495727d600..c52a1096f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(PermeabilityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPermeabilityUnit); } + /// + public Permeability ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PermeabilityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs index 5ae9a8fff6..d51038f7e4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(PermittivityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPermittivityUnit); } + /// + public Permittivity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PermittivityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs index 26133d8e78..3a002dfa52 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.NetFramework.g.cs @@ -843,6 +843,16 @@ public double As(PowerUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -871,9 +881,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPowerUnit); } + /// + public Power ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PowerUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs index e0d16ba632..2ac83f68e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.NetFramework.g.cs @@ -1201,6 +1201,16 @@ public double As(PowerDensityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1229,9 +1239,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPowerDensityUnit); } + /// + public PowerDensity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PowerDensityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs index bc83cdb03f..562592b0fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.NetFramework.g.cs @@ -579,6 +579,16 @@ public double As(PowerRatioUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -607,9 +617,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPowerRatioUnit); } + /// + public PowerRatio ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PowerRatioUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs index 27465118ad..0de7074a04 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.NetFramework.g.cs @@ -1171,6 +1171,16 @@ public double As(PressureUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1199,9 +1209,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPressureUnit); } + /// + public Pressure ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PressureUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs index 1e8d62a7e7..ec49601322 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.NetFramework.g.cs @@ -646,6 +646,16 @@ public double As(PressureChangeRateUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -674,9 +684,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsPressureChangeRateUnit); } + /// + public PressureChangeRate ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(PressureChangeRateUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs index a894e1f018..d12482709f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.NetFramework.g.cs @@ -631,6 +631,16 @@ public double As(RatioUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -659,9 +669,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsRatioUnit); } + /// + public Ratio ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(RatioUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs index 84a0047631..c29961197e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(ReactiveEnergyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsReactiveEnergyUnit); } + /// + public ReactiveEnergy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ReactiveEnergyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs index fab20deff1..26d2466eb0 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.NetFramework.g.cs @@ -601,6 +601,16 @@ public double As(ReactivePowerUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -629,9 +639,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsReactivePowerUnit); } + /// + public ReactivePower ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ReactivePowerUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs index 2566dc57be..202a6a4380 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(RotationalAccelerationUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsRotationalAccelerationUnit); } + /// + public RotationalAcceleration ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(RotationalAccelerationUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs index 2d4c20e3ab..8ef6744919 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.NetFramework.g.cs @@ -736,6 +736,16 @@ public double As(RotationalSpeedUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -764,9 +774,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsRotationalSpeedUnit); } + /// + public RotationalSpeed ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(RotationalSpeedUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs index bebf7c5c35..dff1e57325 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(RotationalStiffnessUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsRotationalStiffnessUnit); } + /// + public RotationalStiffness ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(RotationalStiffnessUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs index e6229d7d1b..9d383a99fa 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(RotationalStiffnessPerLengthUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsRotationalStiffnessPerLengthUnit); } + /// + public RotationalStiffnessPerLength ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(RotationalStiffnessPerLengthUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs index 7045df5cef..6ae3c2670e 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.NetFramework.g.cs @@ -559,6 +559,16 @@ public double As(SolidAngleUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -587,9 +597,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSolidAngleUnit); } + /// + public SolidAngle ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SolidAngleUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs index 4e1361117d..a5951df916 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.NetFramework.g.cs @@ -679,6 +679,16 @@ public double As(SpecificEnergyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -707,9 +717,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSpecificEnergyUnit); } + /// + public SpecificEnergy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SpecificEnergyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs index 82c36fb2e4..0e299a4e98 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.NetFramework.g.cs @@ -661,6 +661,16 @@ public double As(SpecificEntropyUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -689,9 +699,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSpecificEntropyUnit); } + /// + public SpecificEntropy ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SpecificEntropyUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs index eea5cdb3a1..36c84334b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.NetFramework.g.cs @@ -586,6 +586,16 @@ public double As(SpecificVolumeUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -614,9 +624,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSpecificVolumeUnit); } + /// + public SpecificVolume ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SpecificVolumeUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs index 33f0d35baf..05fd09411b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.NetFramework.g.cs @@ -799,6 +799,16 @@ public double As(SpecificWeightUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -827,9 +837,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSpecificWeightUnit); } + /// + public SpecificWeight ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SpecificWeightUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs index 40bc721df2..4256b48629 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.NetFramework.g.cs @@ -1021,6 +1021,16 @@ public double As(SpeedUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1049,9 +1059,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsSpeedUnit); } + /// + public Speed ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(SpeedUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs index db04d15d6b..03a77c1b13 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.NetFramework.g.cs @@ -615,6 +615,16 @@ public double As(TemperatureUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -643,9 +653,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsTemperatureUnit); } + /// + public Temperature ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(TemperatureUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs index 6341ab88b0..fa688de4a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.NetFramework.g.cs @@ -691,6 +691,16 @@ public double As(TemperatureChangeRateUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -719,9 +729,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsTemperatureChangeRateUnit); } + /// + public TemperatureChangeRate ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(TemperatureChangeRateUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs index abb6759f07..1d7a31ee83 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.NetFramework.g.cs @@ -661,6 +661,16 @@ public double As(TemperatureDeltaUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -689,9 +699,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsTemperatureDeltaUnit); } + /// + public TemperatureDelta ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(TemperatureDeltaUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs index 61be4f2706..ae7a939318 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.NetFramework.g.cs @@ -574,6 +574,16 @@ public double As(ThermalConductivityUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -602,9 +612,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsThermalConductivityUnit); } + /// + public ThermalConductivity ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ThermalConductivityUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs index 4d96f4cb3d..50b9bb7246 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.NetFramework.g.cs @@ -616,6 +616,16 @@ public double As(ThermalResistanceUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -644,9 +654,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsThermalResistanceUnit); } + /// + public ThermalResistance ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(ThermalResistanceUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs index 17442ff684..ef0d12198e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.NetFramework.g.cs @@ -856,6 +856,16 @@ public double As(TorqueUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -884,9 +894,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsTorqueUnit); } + /// + public Torque ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(TorqueUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs index fd613666b8..1ca0fb4766 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.NetFramework.g.cs @@ -556,6 +556,16 @@ public double As(VitaminAUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -584,9 +594,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsVitaminAUnit); } + /// + public VitaminA ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(VitaminAUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs index 87c99bf496..d824a5a61c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.NetFramework.g.cs @@ -1216,6 +1216,16 @@ public double As(VolumeUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1244,9 +1254,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsVolumeUnit); } + /// + public Volume ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(VolumeUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs index 0c050a3258..8acf0a6ce8 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.NetFramework.g.cs @@ -1261,6 +1261,16 @@ public double As(VolumeFlowUnit unit) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1289,9 +1299,25 @@ IQuantity IQuantity.ToUnit(Enum unit) return ToUnit(unitAsVolumeFlowUnit); } + /// + public VolumeFlow ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity IQuantity.ToUnit(VolumeFlowUnit unit) => ToUnit(unit); + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 8d133b9223..7a8368fa56 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -29,32 +29,46 @@ public interface IQuantity : IFormattable QuantityInfo QuantityInfo { get; } /// - /// Dynamically convert to another unit representation. + /// Gets the value in the given unit. /// /// The unit enum value. The unit must be compatible, so for you should provide a value. /// Value converted to the specified unit. /// Wrong unit enum type was given. double As(Enum unit); + /// + /// Gets the value in the unit determined by the given . + /// + /// The to convert the quantity value to. + /// The converted value. + double As(UnitSystem unitSystem); + /// /// The unit this quantity was constructed with -or- BaseUnit if default ctor was used. /// Enum Unit { get; } /// - /// The value this quantity was constructed with. Should be seen in combination with . + /// The value this quantity was constructed with. See also . /// double Value { get; } /// - /// Change the default unit representation of the quantity, which affects things like . + /// Converts to a quantity with the given unit representation, which affects things like . /// /// The unit enum value. The unit must be compatible, so for you should provide a value. - /// A new quantity with the given unit as default unit representation. + /// A new quantity with the given unit. IQuantity ToUnit(Enum unit); /// - /// Get string representation of value and unit. Using two significant digits after radix. + /// Converts to a quantity with a unit determined by the given , which affects things like . + /// + /// The to convert the quantity to. + /// A new quantity with the determined unit. + IQuantity ToUnit(UnitSystem unitSystem); + + /// + /// Gets the string representation of value and unit. Uses two significant digits after radix. /// /// String representation. /// Format to use for localization and number formatting. Defaults to if null. @@ -103,10 +117,17 @@ public interface IQuantity : IQuantity where TUnitType : Enum new QuantityInfo QuantityInfo { get; } /// - /// Change the default unit representation of the quantity, which affects things like . + /// Converts to a quantity with the given unit representation, which affects things like . /// - /// - /// + /// The unit enum value. + /// A new quantity with the given unit. IQuantity ToUnit(TUnitType unit); + + /// + /// Converts to a quantity with a unit determined by the given , which affects things like . + /// + /// The to convert the quantity to. + /// A new quantity with the determined unit. + new IQuantity ToUnit(UnitSystem unitSystem); } } diff --git a/UnitsNet/QuantityInfo.cs b/UnitsNet/QuantityInfo.cs index ef6c008e56..ac42edc470 100644 --- a/UnitsNet/QuantityInfo.cs +++ b/UnitsNet/QuantityInfo.cs @@ -125,13 +125,14 @@ public QuantityInfo(QuantityType quantityType, [NotNull] UnitInfo[] unitInfos, [ public BaseDimensions BaseDimensions { get; } /// - /// Gets the which has that are a subset of the given . + /// Gets the whose is a subset of . /// + /// Length.Info.GetUnitInfoFor(unitSystemWithFootAsLengthUnit) returns for . /// The to check against. - /// The UnitInfo that has BaseUnits that are a subset. - /// The baseUnits parameter is null. - /// No unit was found that is a subset of the given BaseUnits. - /// More than one unit was found that is a subset of the given BaseUnits. + /// The that has that is a subset of . + /// is null. + /// No unit was found that is a subset of . + /// More than one unit was found that is a subset of . public UnitInfo GetUnitInfoFor(BaseUnits baseUnits) { if(baseUnits == null) @@ -144,10 +145,10 @@ public UnitInfo GetUnitInfoFor(BaseUnits baseUnits) var firstUnitInfo = matchingUnitInfos.FirstOrDefault(); if (firstUnitInfo == null) - throw new InvalidOperationException("No unit was found that is a subset of the given BaseUnits."); + throw new InvalidOperationException($"No unit was found that is a subset of {nameof(baseUnits)}"); if (matchingUnitInfos.Length > 1) - throw new InvalidOperationException("More than one unit was found that is a subset of the given BaseUnits."); + throw new InvalidOperationException($"More than one unit was found that is a subset of {nameof(baseUnits)}"); return firstUnitInfo; } diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1 index b56e28a3bf..0bd4feccc7 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCode.ps1 @@ -982,6 +982,16 @@ function GenerateConversionMethods([GeneratorArgs]$genArgs) return Convert.ToDouble(converted); } + /// + public double As(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return As(unitForUnitSystem); + } + /// double IQuantity.As(Enum unit) { @@ -1010,9 +1020,25 @@ function GenerateConversionMethods([GeneratorArgs]$genArgs) return ToUnit(unitAs$unitEnumName); } + /// + public $quantityName ToUnit(UnitSystem unitSystem) + { + if(unitSystem == null) + throw new ArgumentNullException(nameof(unitSystem)); + + var unitForUnitSystem = Info.GetUnitInfoFor(unitSystem.BaseUnits).Value; + return ToUnit(unitForUnitSystem); + } + + /// + IQuantity IQuantity.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// IQuantity<$unitEnumName> IQuantity<$unitEnumName>.ToUnit($unitEnumName unit) => ToUnit(unit); + /// + IQuantity<$unitEnumName> IQuantity<$unitEnumName>.ToUnit(UnitSystem unitSystem) => ToUnit(unitSystem); + /// /// Converts the current value + unit to the base unit. /// This is typically the first step in converting from one unit to another. diff --git a/UnitsNet/UnitSystem.cs b/UnitsNet/UnitSystem.cs index 666d7ab387..f55821b7ff 100644 --- a/UnitsNet/UnitSystem.cs +++ b/UnitsNet/UnitSystem.cs @@ -22,19 +22,7 @@ public UnitSystem(BaseUnits baseUnits) if(baseUnits is null) throw new ArgumentNullException(nameof(baseUnits)); - if(baseUnits.Length == LengthUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.Mass == MassUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.Time == DurationUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.Current == ElectricCurrentUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.Temperature == TemperatureUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.Amount == AmountOfSubstanceUnit.Undefined) - throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); - if(baseUnits.LuminousIntensity == LuminousIntensityUnit.Undefined) + if(!baseUnits.IsFullyDefined) throw new ArgumentException("A unit system must have all base units defined.", nameof(baseUnits)); BaseUnits = baseUnits;