diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
index e0daa70c6b..e61a76d62c 100644
--- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
@@ -263,20 +263,10 @@ private void GenerateProperties()
/// The numeric value this quantity was constructed with.
///
public {_valueType} Value => _value;
-");
- Writer.WL(@"
///
QuantityValue IQuantity.Value => _value;
-");
- // Need to provide explicit interface implementation for decimal quantities like Information
- if (_quantity.ValueType == "decimal")
- Writer.WL(@"
- ///
- decimal IDecimalQuantity.Value => _value;
-");
- Writer.WL($@"
Enum IQuantity.Unit => Unit;
///
@@ -959,6 +949,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}}
+ ///
+ {_quantity.ValueType} IValueQuantity<{_quantity.ValueType}>.As(Enum unit)
+ {{
+ if (!(unit is {_unitEnumName} typedUnit))
+ throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit));
+
+ return As(typedUnit);
+ }}
+
///
/// Converts this {_quantity.Name} to another {_quantity.Name} with the unit representation .
///
diff --git a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
index 956b969ad9..02313ea6dd 100644
--- a/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/UnitTestBaseClassGenerator.cs
@@ -164,7 +164,7 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit()
var quantity = new {_quantity.Name}();
Assert.Equal(0, quantity.Value);");
if (_quantity.ValueType == "decimal") Writer.WL(@"
- Assert.Equal(0m, ((IDecimalQuantity)quantity).Value);");
+ Assert.Equal(0m, ((IValueQuantity)quantity).Value);");
Writer.WL($@"
Assert.Equal({_baseUnitFullName}, quantity.Unit);
}}
@@ -278,7 +278,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}}
else
diff --git a/Common/UnitDefinitions/Power.json b/Common/UnitDefinitions/Power.json
index ce491fa507..a6bf85e842 100644
--- a/Common/UnitDefinitions/Power.json
+++ b/Common/UnitDefinitions/Power.json
@@ -12,6 +12,11 @@
{
"SingularName": "Watt",
"PluralName": "Watts",
+ "BaseUnits": {
+ "L": "Meter",
+ "M": "Kilogram",
+ "T": "Second"
+ },
"FromUnitToBaseFunc": "{x}",
"FromBaseToUnitFunc": "{x}",
"Prefixes": [ "Femto", "Pico", "Nano", "Micro", "Milli", "Deci", "Deca", "Kilo", "Mega", "Giga", "Tera", "Peta" ],
diff --git a/UnitsNet.Serialization.JsonNet/AbbreviatedUnitsConverter.cs b/UnitsNet.Serialization.JsonNet/AbbreviatedUnitsConverter.cs
index deb3728b55..86a785f0ae 100644
--- a/UnitsNet.Serialization.JsonNet/AbbreviatedUnitsConverter.cs
+++ b/UnitsNet.Serialization.JsonNet/AbbreviatedUnitsConverter.cs
@@ -79,7 +79,7 @@ public override void WriteJson(JsonWriter writer, IQuantity? quantity, JsonSeria
// write the 'Value' using the actual type
writer.WritePropertyName(ValueProperty);
- if (quantity is IDecimalQuantity decimalQuantity)
+ if (quantity is IValueQuantity decimalQuantity)
{
// cannot use `writer.WriteValue(decimalQuantity.Value)`: there is a hidden EnsureDecimalPlace(..) method call inside it that converts '123' to '123.0'
writer.WriteRawValue(decimalQuantity.Value.ToString(CultureInfo.InvariantCulture));
@@ -177,7 +177,7 @@ protected string GetQuantityType(IQuantity quantity)
{
value = default;
}
- else if (quantityInfo.Zero is IDecimalQuantity)
+ else if (quantityInfo.Zero is IValueQuantity)
{
value = decimal.Parse(valueToken, CultureInfo.InvariantCulture);
}
diff --git a/UnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs b/UnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs
index 3373b27b26..5d7fc1bad5 100644
--- a/UnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs
+++ b/UnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs
@@ -181,7 +181,7 @@ protected ValueUnit ConvertIQuantity(IQuantity quantity)
{
quantity = quantity ?? throw new ArgumentNullException(nameof(quantity));
- if (quantity is IDecimalQuantity d)
+ if (quantity is IValueQuantity d)
{
return new ExtendedValueUnit
{
diff --git a/UnitsNet.Tests/CustomCode/IQuantityTests.cs b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
index 1193a838fa..710cb4df17 100644
--- a/UnitsNet.Tests/CustomCode/IQuantityTests.cs
+++ b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
@@ -57,5 +57,48 @@ public void ToUnit_GivenSIUnitSystem_ReturnsSIQuantity()
Assert.Equal(0.0508, inSI.Value);
Assert.Equal(LengthUnit.Meter, inSI.Unit);
}
+
+
+ [Fact]
+ public void IQuantityTUnitDouble_Value_ReturnsDouble()
+ {
+ IQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.Value);
+ }
+
+ [Fact]
+ public void IQuantityTUnitDouble_AsEnum_ReturnsDouble()
+ {
+ IQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.As(TemperatureUnit.Kelvin));
+ }
+
+ [Fact]
+ public void IQuantityTUnitDouble_AsUnitSystem_ReturnsDouble()
+ {
+ IQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.As(UnitSystem.SI));
+ }
+
+ [Fact]
+ public void IQuantityTUnitDecimal_Value_ReturnsDecimal()
+ {
+ IQuantity decimalQuantity = Information.FromKilobytes(1234.5);
+ Assert.IsType(decimalQuantity.Value);
+ }
+
+ [Fact]
+ public void IQuantityTUnitDecimal_AsEnum_ReturnsDecimal()
+ {
+ IQuantity decimalQuantity = Information.FromKilobytes(1234.5);
+ Assert.IsType(decimalQuantity.As(InformationUnit.Byte));
+ }
+
+ [Fact]
+ public void IQuantityTUnitDecimal_AsUnitSystem_ReturnsDecimal()
+ {
+ IQuantity decimalQuantity = Power.FromMegawatts(1234.5);
+ Assert.IsType(decimalQuantity.As(UnitSystem.SI));
+ }
}
}
diff --git a/UnitsNet.Tests/CustomCode/PowerTests.cs b/UnitsNet.Tests/CustomCode/PowerTests.cs
index d51dfcf453..99ebcec1cc 100644
--- a/UnitsNet.Tests/CustomCode/PowerTests.cs
+++ b/UnitsNet.Tests/CustomCode/PowerTests.cs
@@ -8,7 +8,7 @@ namespace UnitsNet.Tests
{
public class PowerTests : PowerTestsBase
{
- protected override bool SupportsSIUnitSystem => false;
+ protected override bool SupportsSIUnitSystem => true;
protected override decimal FemtowattsInOneWatt => 1e15m;
protected override decimal GigajoulesPerHourInOneWatt => 3600e-9m;
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
index b9b4031d52..8016edae40 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AccelerationTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
index 4f821cb030..6184b15194 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmountOfSubstanceTestsBase.g.cs
@@ -298,7 +298,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
index 3972a733d2..8c8d952df2 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AmplitudeRatioTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
index 8dd363422a..41ad0ce776 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AngleTestsBase.g.cs
@@ -308,7 +308,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs
index 8c46da2ca3..517fd696e6 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentEnergyTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs
index bfd0305f35..c837d97039 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ApparentPowerTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
index 7dc882f27f..7a52efb886 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaDensityTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
index c8341766f7..baad089fb2 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaMomentOfInertiaTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
index 312ca1bc79..a03b6f082f 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/AreaTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
index 33fb9a96c2..be62ba4cc7 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BitRateTestsBase.g.cs
@@ -163,7 +163,7 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit()
{
var quantity = new BitRate();
Assert.Equal(0, quantity.Value);
- Assert.Equal(0m, ((IDecimalQuantity)quantity).Value);
+ Assert.Equal(0m, ((IValueQuantity)quantity).Value);
Assert.Equal(BitRateUnit.BitPerSecond, quantity.Unit);
}
@@ -383,7 +383,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
index 5fd7104f26..48160ebe70 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/BrakeSpecificFuelConsumptionTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs
index adde51fa5e..f4c69001a6 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CapacitanceTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
index 54e262d2ba..348482a755 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CoefficientOfThermalExpansionTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
index e93b3192d6..cd16c66174 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/CompressibilityTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
index c42a8926f8..3027b5c612 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DensityTestsBase.g.cs
@@ -658,7 +658,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
index 08ce04606b..f894a93107 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DurationTestsBase.g.cs
@@ -258,7 +258,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
index ce6780c71a..dd8bc8d531 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/DynamicViscosityTestsBase.g.cs
@@ -248,7 +248,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
index ec89cad3cc..b38c2598ff 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricAdmittanceTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs
index 304cac4a07..0633765b22 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeDensityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs
index cfce7739f1..c4742b14ee 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricChargeTestsBase.g.cs
@@ -258,7 +258,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs
index fa7baabee9..5c9c9a2388 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductanceTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs
index 84a7fc4d3b..5495b54c60 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricConductivityTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs
index 3d170cb479..1e8f4d08e3 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentDensityTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs
index 1300564609..309d178337 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentGradientTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs
index a50faabca5..a562934178 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricCurrentTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs
index b383e3cfb1..e45dad4e08 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricFieldTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs
index ef3bc483dc..b96c40371f 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricInductanceTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs
index 1e78901e00..d1219793c5 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialAcTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs
index 02be3df0f6..e30643eb12 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialChangeRateTestsBase.g.cs
@@ -348,7 +348,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs
index 99c7d1e0c2..15669faa28 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialDcTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs
index 5e033e2005..b375ce83d4 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricPotentialTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs
index ad19149e2d..c69fe1611c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistanceTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs
index 5b21ab2d76..2ce41ad10e 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricResistivityTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs
index 7ebad37a16..04af0291fe 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ElectricSurfaceChargeDensityTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs
index 35e38f5013..57502ee676 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyDensityTestsBase.g.cs
@@ -268,7 +268,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs
index cbe0ad2435..3b76340904 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EnergyTestsBase.g.cs
@@ -528,7 +528,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs
index 67d5b9ffb4..65737394af 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/EntropyTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs
index 24e3b9c5a9..82f5a8ee3c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceChangeRateTestsBase.g.cs
@@ -298,7 +298,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs
index f983e8e7c5..5a75e375d3 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForcePerLengthTestsBase.g.cs
@@ -528,7 +528,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs
index 5f4fa8c7f3..feac3204ae 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ForceTestsBase.g.cs
@@ -298,7 +298,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs
index 1d095a7628..a68228ce0d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FrequencyTestsBase.g.cs
@@ -278,7 +278,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs
index d20db23b84..a558e69faf 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/FuelEfficiencyTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs
index 8beef55ea9..0f653e5ceb 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatFluxTestsBase.g.cs
@@ -328,7 +328,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs
index 565a16cc33..6ff8538e11 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/HeatTransferCoefficientTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs
index 59bcdbbf7c..5bb67f139b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IlluminanceTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs
index 7f08945455..5f556412e4 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ImpulseTestsBase.g.cs
@@ -278,7 +278,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs
index 022e8bc6db..f061b4eca8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/InformationTestsBase.g.cs
@@ -163,7 +163,7 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit()
{
var quantity = new Information();
Assert.Equal(0, quantity.Value);
- Assert.Equal(0m, ((IDecimalQuantity)quantity).Value);
+ Assert.Equal(0m, ((IValueQuantity)quantity).Value);
Assert.Equal(InformationUnit.Bit, quantity.Unit);
}
@@ -383,7 +383,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs
index b868d8809d..fea1eaca85 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradianceTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs
index 20b619ae26..908b49b1f8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/IrradiationTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs
index 9938bea3f4..21e44641e9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/JerkTestsBase.g.cs
@@ -258,7 +258,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs
index 546c4bc6eb..129806d5c9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/KinematicViscosityTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs
index ecae39eee5..590d3b7932 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LengthTestsBase.g.cs
@@ -518,7 +518,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs
index 758b6276f1..0118d7d382 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LevelTestsBase.g.cs
@@ -168,7 +168,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs
index 28cc959b10..7611aa928b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearDensityTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs
index c805da8a11..e052b5c169 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LinearPowerDensityTestsBase.g.cs
@@ -398,7 +398,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs
index 40f8eef698..56d125c861 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminanceTestsBase.g.cs
@@ -248,7 +248,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs
index 01e350beb2..f89aaf41e9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminosityTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs
index ebb4355e2b..94f4eda89e 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousFluxTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs
index 569bae562c..401981527c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/LuminousIntensityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs
index e8e29cf342..6838b70523 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFieldTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs
index 90eb8d829f..9e109a9d60 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagneticFluxTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs
index ca145a2034..43935193f2 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MagnetizationTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs
index 4f2d99d50d..ad27b46c09 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassConcentrationTestsBase.g.cs
@@ -638,7 +638,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs
index a30656566c..6351cb648d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFlowTestsBase.g.cs
@@ -478,7 +478,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs
index 128447a5f1..eab6d4618d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFluxTestsBase.g.cs
@@ -268,7 +268,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs
index 60bbff0698..814eead319 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassFractionTestsBase.g.cs
@@ -388,7 +388,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs
index 4dea92181c..6ed4f77b07 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassMomentOfInertiaTestsBase.g.cs
@@ -428,7 +428,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs
index f720a8afa2..d38d5a703b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MassTestsBase.g.cs
@@ -398,7 +398,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs
index 3236de2c18..8cabd707e9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEnergyTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs
index bd44b39ac5..c915d64342 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarEntropyTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs
index 0f74380ec4..89f673b4d3 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarFlowTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs
index 7953b2e18f..28e3c0f6c3 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarMassTestsBase.g.cs
@@ -278,7 +278,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs
index 1eff8e5907..64f4b2db4b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/MolarityTestsBase.g.cs
@@ -258,7 +258,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs
index 426b50681b..5959b2d99d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermeabilityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs
index 7274dc2139..6ba7c5194d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PermittivityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs
index ef3142c4e1..d7321f40b1 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PorousMediumPermeabilityTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs
index 4425f491b2..3d3e6d9312 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerDensityTestsBase.g.cs
@@ -588,7 +588,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs
index 840496d67d..1b05a986a4 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerRatioTestsBase.g.cs
@@ -168,7 +168,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
index 1ee61d30da..fc2e98998d 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
@@ -163,7 +163,7 @@ public void DefaultCtor_ReturnsQuantityWithZeroValueAndBaseUnit()
{
var quantity = new Power();
Assert.Equal(0, quantity.Value);
- Assert.Equal(0m, ((IDecimalQuantity)quantity).Value);
+ Assert.Equal(0m, ((IValueQuantity)quantity).Value);
Assert.Equal(PowerUnit.Watt, quantity.Unit);
}
@@ -383,7 +383,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs
index 420d66a502..b7e373e91e 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureChangeRateTestsBase.g.cs
@@ -288,7 +288,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs
index 1944b2f7b7..27fe367cbf 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PressureTestsBase.g.cs
@@ -618,7 +618,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs
index 4ed19fe164..eb98e2014b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioChangeRateTestsBase.g.cs
@@ -168,7 +168,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs
index 2b945826ed..dff098a836 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RatioTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs
index 8e90d5345e..ac965968bb 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactiveEnergyTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs
index 23cb5cef94..718b047479 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReactivePowerTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs
index b82ad403c5..e9dd3b8dc1 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalAreaTestsBase.g.cs
@@ -258,7 +258,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs
index e4cab81185..e856fc3bb5 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ReciprocalLengthTestsBase.g.cs
@@ -248,7 +248,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs
index 65a79182c3..36c3ebfc5a 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RelativeHumidityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs
index 8eb5dd95bd..96aef71bb8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalAccelerationTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs
index 3e01da2c3c..a8ec0147c7 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalSpeedTestsBase.g.cs
@@ -278,7 +278,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs
index 3d4090c9fc..49ed69b1cc 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessPerLengthTestsBase.g.cs
@@ -198,7 +198,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs
index 95ae7f4ac0..9570dbe397 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/RotationalStiffnessTestsBase.g.cs
@@ -478,7 +478,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs
index 667e951d20..742d059f30 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ScalarTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs
index 1a57021dd1..aa6510723b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SolidAngleTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs
index 526c1562ab..e2c1dafb97 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEnergyTestsBase.g.cs
@@ -448,7 +448,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs
index de6e32957c..2aa80ab7b4 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificEntropyTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs
index 335e29195c..468bd12dbd 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificFuelConsumptionTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs
index 5c412eb5d1..52668dba57 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificVolumeTestsBase.g.cs
@@ -178,7 +178,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs
index 73902e0057..49815d777c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpecificWeightTestsBase.g.cs
@@ -318,7 +318,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs
index 357eb87490..ceafc36b5c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/SpeedTestsBase.g.cs
@@ -478,7 +478,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs
index 258a7ac849..d4567dd0c2 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/StandardVolumeFlowTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs
index 446f5313ab..6ddf89e0b8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureChangeRateTestsBase.g.cs
@@ -248,7 +248,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs
index bb7f3fae98..bcad90eb83 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureDeltaTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs
index 240e3b6d9e..316f9dff2a 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureGradientTestsBase.g.cs
@@ -188,7 +188,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs
index f513c3a776..7bdd29dc4c 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TemperatureTestsBase.g.cs
@@ -248,7 +248,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs
index 7e00226212..9227245c2b 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalConductivityTestsBase.g.cs
@@ -168,7 +168,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs
index eaa1621326..ddfa254927 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/ThermalResistanceTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs
index 1ff5eeb3a6..9a2f2bf6d8 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorquePerLengthTestsBase.g.cs
@@ -358,7 +358,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs
index f7605bc1ba..7875a5097f 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TorqueTestsBase.g.cs
@@ -398,7 +398,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs
index 953d5b5fa7..394321a806 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/TurbidityTestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs
index 3b9a0dabad..eade4a13f4 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VitaminATestsBase.g.cs
@@ -158,7 +158,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs
index 7fb476ac77..e3f0c10976 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeConcentrationTestsBase.g.cs
@@ -348,7 +348,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs
index d90dd054db..9fe1fa7c96 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowPerAreaTestsBase.g.cs
@@ -168,7 +168,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
index 3e8bcbd0ab..fe51c821b5 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeFlowTestsBase.g.cs
@@ -768,7 +768,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
index b61c9682b8..0754d4eb89 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumePerLengthTestsBase.g.cs
@@ -218,7 +218,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs
index ac9688785c..af0271bb30 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs
@@ -678,7 +678,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs
index 0f20f46ef8..41555fb522 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/VolumetricHeatCapacityTestsBase.g.cs
@@ -238,7 +238,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs
index 685163adee..29709c0913 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/WarpingMomentOfInertiaTestsBase.g.cs
@@ -208,7 +208,7 @@ public void As_SIUnitSystem_ThrowsArgumentExceptionIfNotSupported()
if (SupportsSIUnitSystem)
{
- var value = (double) AsWithSIUnitSystem();
+ var value = Convert.ToDouble(AsWithSIUnitSystem());
Assert.Equal(1, value);
}
else
diff --git a/UnitsNet.Tests/IValueQuantityTests.cs b/UnitsNet.Tests/IValueQuantityTests.cs
new file mode 100644
index 0000000000..618ad22194
--- /dev/null
+++ b/UnitsNet.Tests/IValueQuantityTests.cs
@@ -0,0 +1,54 @@
+// Licensed under MIT No Attribution, see LICENSE file at the root.
+// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+
+using UnitsNet.Units;
+using Xunit;
+
+namespace UnitsNet.Tests
+{
+ // ReSharper disable once InconsistentNaming
+ public class IValueQuantityTests
+ {
+ [Fact]
+ public void IValueQuantityTDouble_Value_ReturnsDouble()
+ {
+ IValueQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.Value);
+ }
+
+ [Fact]
+ public void IValueQuantityTDouble_AsEnum_ReturnsDouble()
+ {
+ IValueQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.As(TemperatureUnit.Kelvin));
+ }
+
+ [Fact]
+ public void IValueQuantityTDouble_AsUnitSystem_ReturnsDouble()
+ {
+ IValueQuantity doubleQuantity = Temperature.FromDegreesCelsius(1234.5);
+ Assert.IsType(doubleQuantity.As(UnitSystem.SI));
+ }
+
+ [Fact]
+ public void IValueQuantityTDecimal_Value_ReturnsDecimal()
+ {
+ IValueQuantity decimalQuantity = Information.FromKilobytes(1234.5);
+ Assert.IsType(decimalQuantity.Value);
+ }
+
+ [Fact]
+ public void IValueQuantityTDecimal_AsEnum_ReturnsDecimal()
+ {
+ IValueQuantity decimalQuantity = Information.FromKilobytes(1234.5);
+ Assert.IsType(decimalQuantity.As(InformationUnit.Byte));
+ }
+
+ [Fact]
+ public void IValueQuantityTDecimal_AsUnitSystem_ReturnsDecimal()
+ {
+ IValueQuantity decimalQuantity = Power.FromMegawatts(1234.5);
+ Assert.IsType(decimalQuantity.As(UnitSystem.SI));
+ }
+ }
+}
diff --git a/UnitsNet.Tests/Serialization/SerializationTestsBase.cs b/UnitsNet.Tests/Serialization/SerializationTestsBase.cs
index 0b754a796e..476cac8173 100644
--- a/UnitsNet.Tests/Serialization/SerializationTestsBase.cs
+++ b/UnitsNet.Tests/Serialization/SerializationTestsBase.cs
@@ -293,7 +293,7 @@ public void ClassOfInterfaceQuantity_SerializationRoundTrips()
}
[Fact]
- public void ClassOfInterfaceDecimalQuantity_SerializationRoundTrips()
+ public void ClassOfInterfaceDecimalValueQuantity_SerializationRoundTrips()
{
var quantity = new Information(2, InformationUnit.Exabyte);
var quantityObject = new TestInterfaceObject { Quantity = quantity };
@@ -302,9 +302,9 @@ public void ClassOfInterfaceDecimalQuantity_SerializationRoundTrips()
var result = DeserializeObject(payload);
Assert.Equal(quantity.Unit, result.Quantity.Unit);
- Assert.Equal(quantity.Value, ((IDecimalQuantity)result.Quantity).Value);
+ Assert.Equal(quantity.Value, ((IValueQuantity)result.Quantity).Value);
Assert.Equal(quantity, result.Quantity);
- Assert.Equal("2", ((IDecimalQuantity)result.Quantity).Value.ToString(CultureInfo.InvariantCulture));
+ Assert.Equal("2", ((IValueQuantity)result.Quantity).Value.ToString(CultureInfo.InvariantCulture));
}
[DataContract]
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
index 921f2e1482..9fdd528cb8 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
@@ -895,6 +895,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AccelerationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Acceleration to another Acceleration with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
index 2842bf58c2..58e8ee92a3 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
@@ -900,6 +900,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AmountOfSubstanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this AmountOfSubstance to another AmountOfSubstance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
index 5ccbac4995..f6f34c6973 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
@@ -699,6 +699,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AmplitudeRatioUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this AmplitudeRatio to another AmplitudeRatio with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
index 05c1d86de0..b79f105841 100644
--- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
@@ -931,6 +931,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AngleUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Angle to another Angle with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
index 866f4d92c1..21ee5366b9 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ApparentEnergyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentEnergyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ApparentEnergy to another ApparentEnergy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
index 5b499b60e8..f9ef906100 100644
--- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs
@@ -729,6 +729,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ApparentPowerUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ApparentPowerUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ApparentPower to another ApparentPower with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
index d06e1499f8..662c789d28 100644
--- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
@@ -908,6 +908,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AreaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Area to another Area with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
index 4704fa98d9..7d607bc345 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AreaDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this AreaDensity to another AreaDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
index a3578ecf26..746ce4d4f4 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
@@ -729,6 +729,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is AreaMomentOfInertiaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this AreaMomentOfInertia to another AreaMomentOfInertia with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
index 96f894e4de..19dd109685 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
@@ -171,9 +171,6 @@ public BitRate(decimal value, UnitSystem unitSystem)
///
QuantityValue IQuantity.Value => _value;
- ///
- decimal IDecimalQuantity.Value => _value;
-
Enum IQuantity.Unit => Unit;
///
@@ -1126,6 +1123,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ decimal IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is BitRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this BitRate to another BitRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
index 34eaf9533b..52e44d0e40 100644
--- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is BrakeSpecificFuelConsumptionUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this BrakeSpecificFuelConsumption to another BrakeSpecificFuelConsumption with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs
index 4e390abdbd..471399db65 100644
--- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs
@@ -751,6 +751,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is CapacitanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CapacitanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Capacitance to another Capacitance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
index dec84fe60a..5173509c2b 100644
--- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is CoefficientOfThermalExpansionUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
index dbeb81660d..4161a583f8 100644
--- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
@@ -748,6 +748,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is CompressibilityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CompressibilityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Compressibility to another Compressibility with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
index 2490c40964..69e6ae9b1a 100644
--- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
@@ -1591,6 +1591,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is DensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Density to another Density with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
index 7410c4f642..338ca99b7f 100644
--- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
@@ -834,6 +834,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is DurationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Duration to another Duration with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
index 895ee1abb6..5809441010 100644
--- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
@@ -808,6 +808,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is DynamicViscosityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this DynamicViscosity to another DynamicViscosity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
index 0f61946654..ab51ace9c6 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
@@ -691,6 +691,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricAdmittanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricAdmittance to another ElectricAdmittance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
index be9a257343..91d577d2f2 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
@@ -827,6 +827,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricChargeUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricCharge to another ElectricCharge with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
index f9ad7f0772..8a29c42846 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricChargeDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricChargeDensity to another ElectricChargeDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
index ff471bba8a..0bc076045b 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
@@ -713,6 +713,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricConductanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricConductance to another ElectricConductance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
index 6531fa140f..a6e7bbd3dd 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
@@ -732,6 +732,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricConductivityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricConductivity to another ElectricConductivity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
index db044e38a1..870da78faf 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
@@ -786,6 +786,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricCurrentUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricCurrent to another ElectricCurrent with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
index 1916af48b1..8ce1f8de79 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
@@ -675,6 +675,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricCurrentDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricCurrentDensity to another ElectricCurrentDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
index adeb31f58c..380fb60fea 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
@@ -691,6 +691,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricCurrentGradientUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricCurrentGradient to another ElectricCurrentGradient with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
index fac5a21a45..db6abbd9d2 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricFieldUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricField to another ElectricField with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
index 3d8221c657..682ed529fd 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
@@ -713,6 +713,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricInductanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricInductance to another ElectricInductance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
index 0bb1134989..fd76f209bb 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
@@ -735,6 +735,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricPotentialUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricPotential to another ElectricPotential with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs
index 867cc6cc47..6170b97093 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs
@@ -710,6 +710,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricPotentialAcUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialAcUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricPotentialAc to another ElectricPotentialAc with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
index 43452b2a53..c198ca221e 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
@@ -995,6 +995,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricPotentialChangeRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialChangeRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricPotentialChangeRate to another ElectricPotentialChangeRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs
index 2230876257..a336179a3e 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs
@@ -710,6 +710,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricPotentialDcUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialDcUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricPotentialDc to another ElectricPotentialDc with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
index 1faefc9fa5..820cc7f4f7 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
@@ -748,6 +748,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricResistanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricResistance to another ElectricResistance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
index d19366611a..069afa43de 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
@@ -884,6 +884,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricResistivityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricResistivity to another ElectricResistivity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
index 88f7b812ed..c00518e9c4 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
@@ -675,6 +675,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ElectricSurfaceChargeDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ElectricSurfaceChargeDensity to another ElectricSurfaceChargeDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
index 9797290495..7db594f8f5 100644
--- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
@@ -1358,6 +1358,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is EnergyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Energy to another Energy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
index 84910f1749..fb5391430c 100644
--- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
@@ -843,6 +843,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is EnergyDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this EnergyDensity to another EnergyDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
index 2367158e28..b81e9cd74b 100644
--- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
@@ -748,6 +748,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is EntropyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Entropy to another Entropy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs
index ebac573589..93d2554ed9 100644
--- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs
@@ -913,6 +913,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ForceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Force to another Force with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
index 2e8af89c60..ca48845652 100644
--- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
@@ -900,6 +900,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ForceChangeRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ForceChangeRate to another ForceChangeRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
index b4f7587b04..a301626bbf 100644
--- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
@@ -1343,6 +1343,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ForcePerLengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ForcePerLength to another ForcePerLength with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
index e7e54467ba..377ada5636 100644
--- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
@@ -871,6 +871,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is FrequencyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Frequency to another Frequency with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
index bfb3b0716a..8db185b622 100644
--- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
@@ -694,6 +694,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is FuelEfficiencyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this FuelEfficiency to another FuelEfficiency with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
index 987298400c..d98c85a584 100644
--- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
@@ -957,6 +957,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is HeatFluxUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this HeatFlux to another HeatFlux with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
index 2574b8dc77..7ee9143c1b 100644
--- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
@@ -731,6 +731,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is HeatTransferCoefficientUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this HeatTransferCoefficient to another HeatTransferCoefficient with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
index 57018f10d8..c936365554 100644
--- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
@@ -694,6 +694,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is IlluminanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Illuminance to another Illuminance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
index e94caf4f4c..cc1d8548e5 100644
--- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
@@ -862,6 +862,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ImpulseUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ImpulseUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Impulse to another Impulse with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs
index 24ab07c03f..11ddba85a1 100644
--- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs
@@ -168,9 +168,6 @@ public Information(decimal value, UnitSystem unitSystem)
///
QuantityValue IQuantity.Value => _value;
- ///
- decimal IDecimalQuantity.Value => _value;
-
Enum IQuantity.Unit => Unit;
///
@@ -1123,6 +1120,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ decimal IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is InformationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Information to another Information with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
index 6db9d2de38..2366924f69 100644
--- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
@@ -881,6 +881,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is IrradianceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Irradiance to another Irradiance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
index eb2fb8cb1e..1e63f7f9ea 100644
--- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
@@ -751,6 +751,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is IrradiationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Irradiation to another Irradiation with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
index 3d0c9eae05..2fb086a815 100644
--- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
@@ -835,6 +835,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is JerkUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(JerkUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Jerk to another Jerk with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
index 621956eab2..018014ffb8 100644
--- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
@@ -797,6 +797,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is KinematicViscosityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this KinematicViscosity to another KinematicViscosity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs
index ccb2bc2bb3..5ff3db518d 100644
--- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs
@@ -1352,6 +1352,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Length to another Length with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs
index d69d2b191a..c958144ce2 100644
--- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs
@@ -661,6 +661,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LevelUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Level to another Level with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
index e2a252f20f..6076d0032e 100644
--- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
@@ -884,6 +884,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LinearDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this LinearDensity to another LinearDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
index 776aacd938..b6f5f7f8df 100644
--- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
@@ -1093,6 +1093,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LinearPowerDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearPowerDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this LinearPowerDensity to another LinearPowerDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
index 0caa7f598d..e4e45ada9b 100644
--- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
@@ -808,6 +808,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LuminanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Luminance to another Luminance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
index 7e67fb8b71..a7c16b8775 100644
--- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
@@ -884,6 +884,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LuminosityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Luminosity to another Luminosity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
index b299c010bf..490196ef85 100644
--- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LuminousFluxUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this LuminousFlux to another LuminousFlux with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
index f2274c6cc5..a1ecb5fc36 100644
--- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is LuminousIntensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this LuminousIntensity to another LuminousIntensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
index 4557dccb04..4712b8564b 100644
--- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
@@ -732,6 +732,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MagneticFieldUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MagneticField to another MagneticField with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
index 28b8827150..4fb7eced9c 100644
--- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MagneticFluxUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MagneticFlux to another MagneticFlux with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
index 1bca0a2b61..c23f3ace63 100644
--- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MagnetizationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Magnetization to another Magnetization with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
index c62b18286f..eab426b65c 100644
--- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
@@ -1125,6 +1125,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Mass to another Mass with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
index b5f34a6c52..34d6c68a83 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
@@ -1553,6 +1553,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassConcentrationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MassConcentration to another MassConcentration with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
index 3bf50636ba..4ecfb0c8c3 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
@@ -1244,6 +1244,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassFlowUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MassFlow to another MassFlow with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
index af1d79e8c7..696c87c907 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
@@ -843,6 +843,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassFluxUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MassFlux to another MassFlux with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
index 28e05cdbe8..6723ee4887 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
@@ -1074,6 +1074,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassFractionUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MassFraction to another MassFraction with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
index 1e14c692e1..0c5809e8dc 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
@@ -1147,6 +1147,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MassMomentOfInertiaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MassMomentOfInertia to another MassMomentOfInertia with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs
index 6047773807..14ce6089d0 100644
--- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MolarEnergyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEnergyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MolarEnergy to another MolarEnergy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs
index d35c537df0..1b3cf30690 100644
--- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MolarEntropyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarEntropyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MolarEntropy to another MolarEntropy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs
index 0cf791e10f..1d2a35ecef 100644
--- a/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MolarFlow.g.cs
@@ -786,6 +786,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MolarFlowUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarFlowUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MolarFlow to another MolarFlow with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs
index 37c5edb8aa..7950c05c47 100644
--- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs
@@ -874,6 +874,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MolarMassUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarMassUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this MolarMass to another MolarMass with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs
index 13370129df..d23bb41c27 100644
--- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs
@@ -827,6 +827,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is MolarityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MolarityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Molarity to another Molarity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs
index fd5c8a5aee..5ab4ecd998 100644
--- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PermeabilityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermeabilityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Permeability to another Permeability with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs
index 9c67df0418..8460e4ba26 100644
--- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PermittivityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PermittivityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Permittivity to another Permittivity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs
index b5ccb646d1..2039ae5ac5 100644
--- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs
@@ -713,6 +713,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PorousMediumPermeabilityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PorousMediumPermeabilityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this PorousMediumPermeability to another PorousMediumPermeability with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs
index 0231219be2..b9c74919fc 100644
--- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs
@@ -84,7 +84,7 @@ static Power()
new UnitInfo(PowerUnit.Petawatt, "Petawatts", BaseUnits.Undefined),
new UnitInfo(PowerUnit.Picowatt, "Picowatts", BaseUnits.Undefined),
new UnitInfo(PowerUnit.Terawatt, "Terawatts", BaseUnits.Undefined),
- new UnitInfo(PowerUnit.Watt, "Watts", BaseUnits.Undefined),
+ new UnitInfo(PowerUnit.Watt, "Watts", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Second)),
},
BaseUnit, Zero, BaseDimensions);
@@ -168,9 +168,6 @@ public Power(decimal value, UnitSystem unitSystem)
///
QuantityValue IQuantity.Value => _value;
- ///
- decimal IDecimalQuantity.Value => _value;
-
Enum IQuantity.Unit => Unit;
///
@@ -1123,6 +1120,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ decimal IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PowerUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Power to another Power with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs
index 205a7740fa..1d8d532283 100644
--- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs
@@ -1451,6 +1451,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PowerDensityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerDensityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this PowerDensity to another PowerDensity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs
index ff388d847a..6a403d7ac0 100644
--- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs
@@ -661,6 +661,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PowerRatioUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PowerRatioUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this PowerRatio to another PowerRatio with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs
index cda567e6cd..8910336f55 100644
--- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs
@@ -1539,6 +1539,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PressureUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Pressure to another Pressure with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs
index 9ffc554d25..05bc50431b 100644
--- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs
@@ -895,6 +895,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is PressureChangeRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(PressureChangeRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this PressureChangeRate to another PressureChangeRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs
index d135bd20e2..01f7913f5f 100644
--- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs
@@ -729,6 +729,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RatioUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Ratio to another Ratio with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs
index c222e51bf0..3ec2b97db9 100644
--- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs
@@ -653,6 +653,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RatioChangeRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RatioChangeRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RatioChangeRate to another RatioChangeRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs
index ff9d52ac54..206209c26b 100644
--- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ReactiveEnergyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactiveEnergyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ReactiveEnergy to another ReactiveEnergy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs
index 4456bf47eb..9588e3c710 100644
--- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs
@@ -691,6 +691,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ReactivePowerUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReactivePowerUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ReactivePower to another ReactivePower with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs
index 915724f559..21977e759c 100644
--- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs
@@ -827,6 +827,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ReciprocalAreaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalAreaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ReciprocalArea to another ReciprocalArea with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs
index 39ab8e8572..deb264b728 100644
--- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs
@@ -808,6 +808,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ReciprocalLengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ReciprocalLengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ReciprocalLength to another ReciprocalLength with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs
index 44de21aed7..b7cb59e319 100644
--- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs
@@ -634,6 +634,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RelativeHumidityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RelativeHumidityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RelativeHumidity to another RelativeHumidity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs
index a494bcb16f..8d3b15451b 100644
--- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs
@@ -691,6 +691,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RotationalAccelerationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalAccelerationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RotationalAcceleration to another RotationalAcceleration with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs
index 0a0992ac54..4d8dbe2081 100644
--- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs
@@ -874,6 +874,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RotationalSpeedUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalSpeedUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RotationalSpeed to another RotationalSpeed with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs
index ac493b59b0..5145cd0850 100644
--- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs
@@ -1242,6 +1242,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RotationalStiffnessUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RotationalStiffness to another RotationalStiffness with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs
index 4258cfea66..7f834dbab8 100644
--- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs
@@ -710,6 +710,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is RotationalStiffnessPerLengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(RotationalStiffnessPerLengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this RotationalStiffnessPerLength to another RotationalStiffnessPerLength with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs
index 00e55d6fb7..c601451df5 100644
--- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs
@@ -634,6 +634,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ScalarUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ScalarUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Scalar to another Scalar with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs
index 59248425aa..8ca6215c64 100644
--- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SolidAngleUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SolidAngleUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SolidAngle to another SolidAngle with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs
index 59487a9a03..07f717e007 100644
--- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs
@@ -1188,6 +1188,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpecificEnergyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEnergyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SpecificEnergy to another SpecificEnergy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs
index 242f08db4d..46f3ae4fb4 100644
--- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs
@@ -786,6 +786,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpecificEntropyUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificEntropyUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SpecificEntropy to another SpecificEntropy with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs
index c1ef4d2777..3ee779e403 100644
--- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs
@@ -694,6 +694,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpecificFuelConsumptionUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificFuelConsumptionUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SpecificFuelConsumption to another SpecificFuelConsumption with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs
index 031fe02753..807f05c68e 100644
--- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs
@@ -672,6 +672,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpecificVolumeUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificVolumeUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SpecificVolume to another SpecificVolume with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs
index bb6d7b8228..2304a20d36 100644
--- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs
@@ -941,6 +941,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpecificWeightUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpecificWeightUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this SpecificWeight to another SpecificWeight with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs
index 5ff449e457..bc0af021b7 100644
--- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs
@@ -1266,6 +1266,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is SpeedUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(SpeedUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Speed to another Speed with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs
index 6cf1d8745f..e9658315d3 100644
--- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs
@@ -786,6 +786,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is StandardVolumeFlowUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(StandardVolumeFlowUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this StandardVolumeFlow to another StandardVolumeFlow with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs
index 17e7545e48..020d5e600b 100644
--- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs
@@ -756,6 +756,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TemperatureUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Temperature to another Temperature with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs
index c5be0039ec..145fe111d4 100644
--- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs
@@ -805,6 +805,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TemperatureChangeRateUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureChangeRateUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this TemperatureChangeRate to another TemperatureChangeRate with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs
index 1b2f90a524..9978d28a65 100644
--- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs
@@ -786,6 +786,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TemperatureDeltaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureDeltaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this TemperatureDelta to another TemperatureDelta with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs
index 7829ab0664..1681312263 100644
--- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs
@@ -691,6 +691,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TemperatureGradientUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TemperatureGradientUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this TemperatureGradient to another TemperatureGradient with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs
index 9ded06f1cc..c81c124604 100644
--- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs
@@ -656,6 +656,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ThermalConductivityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalConductivityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ThermalConductivity to another ThermalConductivity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs
index 755ad9144d..98bb969d1f 100644
--- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs
@@ -729,6 +729,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is ThermalResistanceUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ThermalResistanceUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this ThermalResistance to another ThermalResistance with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs
index 433ca561fb..61ad68f98f 100644
--- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs
@@ -1093,6 +1093,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TorqueUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorqueUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Torque to another Torque with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs
index 2cf994cf87..a3af0ed65e 100644
--- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs
@@ -1017,6 +1017,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TorquePerLengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TorquePerLengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this TorquePerLength to another TorquePerLength with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs
index 8b62dc4804..f1172756c9 100644
--- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs
@@ -637,6 +637,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is TurbidityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(TurbidityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Turbidity to another Turbidity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs
index a640fa6707..e186cc3a27 100644
--- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs
@@ -634,6 +634,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VitaminAUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VitaminAUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VitaminA to another VitaminA with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs
index cd6c51293b..43e29255db 100644
--- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs
@@ -1670,6 +1670,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumeUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this Volume to another Volume with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs
index e806d9b997..be24c8e70d 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs
@@ -998,6 +998,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumeConcentrationUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeConcentrationUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VolumeConcentration to another VolumeConcentration with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
index ffc626fd89..a58b966a52 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs
@@ -1820,6 +1820,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumeFlowUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VolumeFlow to another VolumeFlow with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs
index d0c8472445..867bf391c6 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs
@@ -653,6 +653,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumeFlowPerAreaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumeFlowPerAreaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VolumeFlowPerArea to another VolumeFlowPerArea with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
index 2e174cce63..06f571cf92 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs
@@ -748,6 +748,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumePerLengthUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumePerLengthUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VolumePerLength to another VolumePerLength with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs
index 35a192850a..5875466b1a 100644
--- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs
@@ -789,6 +789,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is VolumetricHeatCapacityUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(VolumetricHeatCapacityUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this VolumetricHeatCapacity to another VolumetricHeatCapacity with the unit representation .
///
diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs
index 39874471e7..3354c563ba 100644
--- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs
@@ -729,6 +729,15 @@ double IQuantity.As(Enum unit)
return (double)As(typedUnit);
}
+ ///
+ double IValueQuantity.As(Enum unit)
+ {
+ if (!(unit is WarpingMomentOfInertiaUnit typedUnit))
+ throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(WarpingMomentOfInertiaUnit)} is supported.", nameof(unit));
+
+ return As(typedUnit);
+ }
+
///
/// Converts this WarpingMomentOfInertia to another WarpingMomentOfInertia with the unit representation .
///
diff --git a/UnitsNet/IDecimalQuantity.cs b/UnitsNet/IDecimalQuantity.cs
index 41ccd7787f..31fe515ac6 100644
--- a/UnitsNet/IDecimalQuantity.cs
+++ b/UnitsNet/IDecimalQuantity.cs
@@ -1,16 +1,18 @@
// Licensed under MIT No Attribution, see LICENSE file at the root.
// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet.
+using System;
+
namespace UnitsNet
{
///
/// Represents a quantity with a decimal value.
///
- public interface IDecimalQuantity
+ ///
+ /// This interface is obsolete. Please use
+ ///
+ [Obsolete("Use the IValueQuantity interface.")]
+ public interface IDecimalQuantity : IValueQuantity
{
- ///
- /// The decimal value this quantity was constructed with.
- ///
- decimal Value { get; }
}
}
diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs
index 1ea0530d90..cb4ebdb6a4 100644
--- a/UnitsNet/IQuantity.cs
+++ b/UnitsNet/IQuantity.cs
@@ -86,7 +86,9 @@ public interface IQuantity : IFormattable
/// IQuantity{LengthUnit} length;
/// double centimeters = length.As(LengthUnit.Centimeter); // Type safety on enum type
///
- public interface IQuantity : IQuantity where TUnitType : Enum
+ /// The unit type of the quantity.
+ public interface IQuantity : IQuantity
+ where TUnitType : Enum
{
///
/// Convert to a unit representation .
@@ -117,20 +119,45 @@ public interface IQuantity : IQuantity where TUnitType : Enum
new IQuantity ToUnit(UnitSystem unitSystem);
}
+ ///
+ /// A quantity backed by a particular value type with a stronger typed interface where the unit enum type is known, to avoid passing in the
+ /// wrong unit enum type and not having to cast from .
+ ///
+ /// The unit type of the quantity.
+ /// The value type of the quantity.
+ public interface IQuantity : IQuantity, IValueQuantity
+ where TUnitType : Enum
+#if NET7_0_OR_GREATER
+ where TValueType : INumber
+#else
+ where TValueType : struct
+#endif
+ {
+ ///
+ /// Convert to a unit representation .
+ ///
+ /// Value converted to the specified unit.
+ new TValueType As(TUnitType unit);
+ }
+
///
/// An that (in .NET 7+) implements generic math interfaces for equality, comparison and parsing.
///
/// The type itself, for the CRT pattern.
/// The underlying unit enum type.
/// The underlying value type for internal representation.
- public interface IQuantity : IQuantity
+ public interface IQuantity : IQuantity
#if NET7_0_OR_GREATER
, IComparisonOperators
, IParsable
#endif
where TSelf : IQuantity
where TUnitType : Enum
+#if NET7_0_OR_GREATER
+ where TValueType : INumber
+#else
where TValueType : struct
+#endif
{
}
}
diff --git a/UnitsNet/IValueQuantity.cs b/UnitsNet/IValueQuantity.cs
new file mode 100644
index 0000000000..c94c282314
--- /dev/null
+++ b/UnitsNet/IValueQuantity.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Numerics;
+using UnitsNet.Units;
+
+namespace UnitsNet
+{
+ ///
+ /// Represents a quantity backed by a particular value type, such as or .
+ ///
+ ///
+ /// Currently, only 3 quantities are backed by : , and .
+ ///
+ /// The future of decimal support is uncertain. We may either change everything to double to simplify, or use generics or
+ /// more broadly to better support any value type.
+ ///
+ /// The quantity originally introduced decimal due to precision issues with large units and due to the implementation at that
+ /// time storing the value in the base unit. This is no longer as big of a problem after changing to unit-value representation, since you typically
+ /// convert to similar sized units. There is also the option of specifying conversion functions directly between any 2 units to further improve precision.
+ ///
+ /// /, however, do map more naturally to decimal, since its smallest unit is an integer value,
+ /// similar to 100ns ticks as the smallest unit in and .
+ ///
+ /// The value type of the quantity.
+ public interface IValueQuantity : IQuantity
+#if NET7_0_OR_GREATER
+ where TValueType : INumber
+#else
+ where TValueType : struct
+#endif
+ {
+ ///
+ /// The value this quantity was constructed with. See also .
+ ///
+ new TValueType Value { get; }
+
+ ///
+ /// 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.
+ new TValueType As(Enum unit);
+
+ ///
+ /// Gets the value in the unit determined by the given . If multiple units were found for the given ,
+ /// the first match will be used.
+ ///
+ /// The to convert the quantity value to.
+ /// The converted value.
+ new TValueType As(UnitSystem unitSystem);
+ }
+}