diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
index f6f2bf0496..227d2d6b06 100644
--- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
@@ -1024,7 +1024,7 @@ public double As({_unitEnumName} unit)
Writer.WL( $@"
- ///
+ ///
public double As(UnitKey unitKey)
{{
return As(unitKey.ToUnit<{_unitEnumName}>());
@@ -1129,30 +1129,6 @@ private bool TryToUnit({_unitEnumName} unit, [NotNullWhen(true)] out {_quantity.
}}
");
Writer.WL($@"
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {{
- if (unit is not {_unitEnumName} typedUnit)
- throw new ArgumentException($""The given unit is of type {{unit.GetType()}}. Only {{typeof({_unitEnumName})}} is supported."", nameof(unit));
-
- return As(typedUnit);
- }}
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }}
-
- ///
- IQuantity<{_unitEnumName}> IQuantity<{_unitEnumName}>.ToUnit({_unitEnumName} unit) => ToUnit(unit);
-
- #endregion
-
#endregion
");
}
diff --git a/UnitsNet.Tests/CustomCode/IQuantityTests.cs b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
index 6ed292b617..6fd098c668 100644
--- a/UnitsNet.Tests/CustomCode/IQuantityTests.cs
+++ b/UnitsNet.Tests/CustomCode/IQuantityTests.cs
@@ -7,15 +7,60 @@ namespace UnitsNet.Tests;
public partial class IQuantityTests
{
[Fact]
- public void As_GivenWrongUnitType_ThrowsArgumentException()
+ public void As_GivenWrongUnitType_ThrowsUnitNotFoundException()
{
- Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.As(ComparisonType.Absolute)); });
+ Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.As(ComparisonType.Absolute)); });
}
[Fact]
- public void ToUnit_GivenWrongUnitType_ThrowsArgumentException()
+ public void ToUnit_GivenWrongUnitType_ThrowsUnitNotFoundException()
{
- Assert.All(Quantity.Infos.Select(x => x.Zero), quantity => { Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute)); });
+ Assert.All(Quantity.Infos.Select(x => x.Zero),
+ quantity => { Assert.Throws(() => quantity.ToUnit(ComparisonType.Absolute)); });
+ }
+
+ [Fact]
+ public void As_InterfaceReferences_ReturnConvertedValue()
+ {
+ var mass = Mass.FromKilograms(1);
+ IQuantity quantity = mass;
+ IQuantity typedQuantity = mass;
+
+ Assert.Equal(1000, quantity.As(MassUnit.Gram));
+ Assert.Equal(1000, typedQuantity.As(MassUnit.Gram));
+ }
+
+ [Fact]
+ public void ToUnit_IQuantityFromNonBaseUnit_ReturnsConvertedQuantity()
+ {
+ IQuantity quantity = Length.FromKilometers(1);
+
+ IQuantity convertedQuantity = quantity.ToUnit(LengthUnit.Centimeter);
+
+ Assert.Equal(100_000, convertedQuantity.Value);
+ Assert.Equal(LengthUnit.Centimeter, convertedQuantity.Unit);
+ }
+
+ [Fact]
+ public void ToUnit_GenericConstraintWithCustomConverter_UsesProvidedConverter()
+ {
+ var converter = new UnitConverter();
+ converter.SetConversionFunction(
+ LengthUnit.Meter,
+ LengthUnit.Centimeter,
+ _ => Length.FromCentimeters(123));
+
+ Length convertedQuantity = ConvertToUnit(Length.FromMeters(1), LengthUnit.Centimeter, converter);
+
+ Assert.Equal(123, convertedQuantity.Value);
+ Assert.Equal(LengthUnit.Centimeter, convertedQuantity.Unit);
+
+ static TQuantity ConvertToUnit(TQuantity quantity, TUnit unit, UnitConverter unitConverter)
+ where TQuantity : IQuantity
+ where TUnit : struct, Enum
+ {
+ return quantity.ToUnit(unit, unitConverter);
+ }
}
[Fact]
diff --git a/UnitsNet.Tests/CustomQuantities/HowMuch.cs b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
index 99641b0553..99058b71b8 100644
--- a/UnitsNet.Tests/CustomQuantities/HowMuch.cs
+++ b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
@@ -20,11 +20,6 @@ public static HowMuch From(double value, HowMuchUnit unit)
return new HowMuch(value, unit);
}
- public double As(HowMuchUnit unit)
- {
- throw new NotImplementedException();
- }
-
public HowMuchUnit Unit { get; }
public double Value { get; }
@@ -64,23 +59,6 @@ UnitKey IQuantity.UnitKey
get => UnitKey.ForUnit(Unit);
}
- public double As(Enum unit) => Convert.ToDouble(unit);
- public double As(UnitKey unitKey)
- {
- return As(unitKey.ToUnit());
- }
-
- public IQuantity ToUnit(Enum unit)
- {
- if (unit is HowMuchUnit howMuchUnit) return new HowMuch(As(unit), howMuchUnit);
- throw new ArgumentException("Must be of type HowMuchUnit.", nameof(unit));
- }
-
- public IQuantity ToUnit(HowMuchUnit unit)
- {
- throw new NotImplementedException();
- }
-
public override string ToString()
{
return $"{Value} {Unit}";
diff --git a/UnitsNet/Extensions/QuantityExtensions.cs b/UnitsNet/Extensions/QuantityExtensions.cs
index 56ca36ae85..1edbf05007 100644
--- a/UnitsNet/Extensions/QuantityExtensions.cs
+++ b/UnitsNet/Extensions/QuantityExtensions.cs
@@ -78,12 +78,142 @@ public static UnitInfo GetUnitInfo(this IQua
#endif
}
- ///
- /// This should be using UnitConverter.Default.ConvertValue(quantity, toUnit)
+ private static IQuantity ConvertTo(this UnitConverter converter, IQuantity quantity, UnitKey toUnit)
+ {
+ if (quantity.UnitKey == toUnit)
+ {
+ return quantity;
+ }
+
+ var targetUnit = (Enum)toUnit;
+ Type quantityType = quantity.GetType();
+ if (converter.TryGetConversionFunction(quantityType, quantity.Unit, quantityType, targetUnit, out ConversionFunction? conversionFunction))
+ {
+ return conversionFunction(quantity);
+ }
+
+#pragma warning disable CS0618 // Type or member is obsolete
+ UnitKey baseUnit = quantity.QuantityInfo.BaseUnitInfo.UnitKey;
+#pragma warning restore CS0618 // Type or member is obsolete
+ if (quantity.UnitKey != baseUnit)
+ {
+ IQuantity quantityInBaseUnit = converter.ConvertTo(quantity, baseUnit);
+ return converter.ConvertTo(quantityInBaseUnit, toUnit);
+ }
+
+ throw new UnitNotFoundException($"Can't convert {quantity.Unit} to {targetUnit}.");
+ }
+
+ ///
+ /// Converts a quantity value to the specified unit.
+ ///
+ /// The converter to use.
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted value.
+ internal static double ConvertValue(this UnitConverter converter, TQuantity quantity, UnitKey toUnit)
+ where TQuantity : IQuantity
+ {
+ return converter.ConvertTo(quantity, toUnit).Value;
+ }
+
+ ///
+ /// Converts a quantity to the specified unit while preserving its concrete type.
+ ///
+ /// The converter to use.
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted quantity.
+ internal static TQuantity ConvertToUnit(this UnitConverter converter, TQuantity quantity, UnitKey toUnit)
+ where TQuantity : IQuantityOfType
+ {
+ return (TQuantity)converter.ConvertTo(quantity, toUnit);
+ }
+
+ ///
+ /// Gets the value of a quantity in the specified unit.
+ ///
internal static double GetValue(this TQuantity quantity, UnitKey toUnit)
where TQuantity : IQuantity
{
- return quantity.As(toUnit);
+ return UnitConverter.Default.ConvertValue(quantity, toUnit);
+ }
+
+ ///
+ /// Gets the value of a quantity in the specified unit.
+ ///
+ /// The quantity type.
+ /// The unit enum type.
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted value.
+ public static double As(this TQuantity quantity, TUnit unit)
+ where TQuantity : IQuantity
+ where TUnit : struct, Enum
+ {
+ return UnitConverter.Default.ConvertValue(quantity, UnitKey.ForUnit(unit));
+ }
+
+ ///
+ /// Gets the value of a quantity in the specified unit.
+ ///
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted value.
+ public static double As(this IQuantity quantity, UnitKey unit)
+ {
+ return UnitConverter.Default.ConvertValue(quantity, unit);
+ }
+
+ ///
+ /// Converts a quantity to the specified unit while preserving its concrete type.
+ ///
+ /// The quantity type.
+ /// The unit enum type.
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted quantity.
+ public static TQuantity ToUnit(this TQuantity quantity, TUnit unit)
+ where TQuantity : IQuantity
+ where TUnit : struct, Enum
+ {
+ return quantity.ToUnit(unit, UnitConverter.Default);
+ }
+
+ ///
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converter to use.
+ public static TQuantity ToUnit(this TQuantity quantity, TUnit unit, UnitConverter unitConverter)
+ where TQuantity : IQuantity
+ where TUnit : struct, Enum
+ {
+ if (unitConverter is null) throw new ArgumentNullException(nameof(unitConverter));
+ return unitConverter.ConvertToUnit(quantity, UnitKey.ForUnit(unit));
+ }
+
+ ///
+ /// Converts a quantity to the specified unit.
+ ///
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted quantity.
+ public static IQuantity ToUnit(this IQuantity quantity, UnitKey unit)
+ {
+ return UnitConverter.Default.ConvertTo(quantity, unit);
+ }
+
+ ///
+ /// Converts a quantity to the specified unit.
+ ///
+ /// The unit enum type.
+ /// The quantity to convert.
+ /// The target unit.
+ /// The converted quantity.
+ public static IQuantity ToUnit(this IQuantity quantity, TUnit unit)
+ where TUnit : struct, Enum
+ {
+ return (IQuantity)UnitConverter.Default.ConvertTo(quantity, UnitKey.ForUnit(unit));
}
///
diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
index d289e69141..77eb332c53 100644
--- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
@@ -867,7 +867,7 @@ public double As(AbsorbedDoseOfIonizingRadiationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -979,30 +979,6 @@ private bool TryToUnit(AbsorbedDoseOfIonizingRadiationUnit unit, [NotNullWhen(tr
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AbsorbedDoseOfIonizingRadiationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AbsorbedDoseOfIonizingRadiationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is AbsorbedDoseOfIonizingRadiationUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AbsorbedDoseOfIonizingRadiationUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AbsorbedDoseOfIonizingRadiationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
index 234c7e2265..445b6034d2 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
@@ -869,7 +869,7 @@ public double As(AccelerationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -975,30 +975,6 @@ private bool TryToUnit(AccelerationUnit unit, [NotNullWhen(true)] out Accelerati
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AccelerationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AccelerationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AccelerationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
index 4530d4fef1..8ce7158358 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
@@ -910,7 +910,7 @@ public double As(AmountOfSubstanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1022,30 +1022,6 @@ private bool TryToUnit(AmountOfSubstanceUnit unit, [NotNullWhen(true)] out Amoun
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AmountOfSubstanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmountOfSubstanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AmountOfSubstanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
index 0db3066f16..234cc32009 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
@@ -657,7 +657,7 @@ public double As(AmplitudeRatioUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -743,30 +743,6 @@ private bool TryToUnit(AmplitudeRatioUnit unit, [NotNullWhen(true)] out Amplitud
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AmplitudeRatioUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AmplitudeRatioUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AmplitudeRatioUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
index cea2892db8..766306e78a 100644
--- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
@@ -843,7 +843,7 @@ public double As(AngleUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -951,30 +951,6 @@ private bool TryToUnit(AngleUnit unit, [NotNullWhen(true)] out Angle? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AngleUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AngleUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AngleUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
index 4c97cd7e43..0347b52396 100644
--- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
@@ -946,7 +946,7 @@ public double As(AreaUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1052,30 +1052,6 @@ private bool TryToUnit(AreaUnit unit, [NotNullWhen(true)] out Area? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AreaUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AreaUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
index 4b601d0d7b..4aa15d2020 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
@@ -711,7 +711,7 @@ public double As(AreaDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -799,30 +799,6 @@ private bool TryToUnit(AreaDensityUnit unit, [NotNullWhen(true)] out AreaDensity
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AreaDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AreaDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
index 139d53c57c..9fce10b408 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
@@ -713,7 +713,7 @@ public double As(AreaMomentOfInertiaUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -803,30 +803,6 @@ private bool TryToUnit(AreaMomentOfInertiaUnit unit, [NotNullWhen(true)] out Are
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AreaMomentOfInertiaUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaMomentOfInertiaUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AreaMomentOfInertiaUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaPerLength.g.cs
index c65410d55c..b92b18a527 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaPerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaPerLength.g.cs
@@ -699,7 +699,7 @@ public double As(AreaPerLengthUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -789,30 +789,6 @@ private bool TryToUnit(AreaPerLengthUnit unit, [NotNullWhen(true)] out AreaPerLe
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not AreaPerLengthUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaPerLengthUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is AreaPerLengthUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(AreaPerLengthUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(AreaPerLengthUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
index 818cfb5660..b56d49883f 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
@@ -1219,7 +1219,7 @@ public double As(BitRateUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1375,30 +1375,6 @@ private bool TryToUnit(BitRateUnit unit, [NotNullWhen(true)] out BitRate? conver
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not BitRateUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BitRateUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(BitRateUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
index 0712ae2f68..893d097c69 100644
--- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
@@ -664,7 +664,7 @@ public double As(BrakeSpecificFuelConsumptionUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -748,30 +748,6 @@ private bool TryToUnit(BrakeSpecificFuelConsumptionUnit unit, [NotNullWhen(true)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not BrakeSpecificFuelConsumptionUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(BrakeSpecificFuelConsumptionUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(BrakeSpecificFuelConsumptionUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
index e089f98518..8681802ec9 100644
--- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
@@ -699,7 +699,7 @@ public double As(CoefficientOfThermalExpansionUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -789,30 +789,6 @@ private bool TryToUnit(CoefficientOfThermalExpansionUnit unit, [NotNullWhen(true
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not CoefficientOfThermalExpansionUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CoefficientOfThermalExpansionUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(CoefficientOfThermalExpansionUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
index 6913b3a5fa..c7634fa2ef 100644
--- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
@@ -704,7 +704,7 @@ public double As(CompressibilityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -796,30 +796,6 @@ private bool TryToUnit(CompressibilityUnit unit, [NotNullWhen(true)] out Compres
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not CompressibilityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(CompressibilityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(CompressibilityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
index 9c91a1f337..15893d1f74 100644
--- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
@@ -1558,7 +1558,7 @@ public double As(DensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1748,30 +1748,6 @@ private bool TryToUnit(DensityUnit unit, [NotNullWhen(true)] out Density? conver
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not DensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(DensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
index f6b774c5a6..5e49b5e30b 100644
--- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
@@ -995,7 +995,7 @@ public double As(DoseAreaProductUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1123,30 +1123,6 @@ private bool TryToUnit(DoseAreaProductUnit unit, [NotNullWhen(true)] out DoseAre
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not DoseAreaProductUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DoseAreaProductUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is DoseAreaProductUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DoseAreaProductUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(DoseAreaProductUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
index f8ab8fb0b1..2ed6aec1c4 100644
--- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
@@ -909,7 +909,7 @@ public double As(DurationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1013,30 +1013,6 @@ private bool TryToUnit(DurationUnit unit, [NotNullWhen(true)] out Duration? conv
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not DurationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DurationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(DurationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
index c9bb82381a..0721e509b0 100644
--- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
@@ -773,7 +773,7 @@ public double As(DynamicViscosityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -871,30 +871,6 @@ private bool TryToUnit(DynamicViscosityUnit unit, [NotNullWhen(true)] out Dynami
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not DynamicViscosityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(DynamicViscosityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(DynamicViscosityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
index 2c73e10db8..a5cf511858 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs
@@ -852,7 +852,7 @@ public double As(ElectricAdmittanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -962,30 +962,6 @@ private bool TryToUnit(ElectricAdmittanceUnit unit, [NotNullWhen(true)] out Elec
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricAdmittanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricAdmittanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricAdmittanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs
index 8862908d3a..b25622f7be 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentEnergy.g.cs
@@ -640,7 +640,7 @@ public double As(ElectricApparentEnergyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -724,30 +724,6 @@ private bool TryToUnit(ElectricApparentEnergyUnit unit, [NotNullWhen(true)] out
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricApparentEnergyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricApparentEnergyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricApparentEnergyUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricApparentEnergyUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricApparentEnergyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
index 8ea03545e8..aebc5cd178 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricApparentPower.g.cs
@@ -691,7 +691,7 @@ public double As(ElectricApparentPowerUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -781,30 +781,6 @@ private bool TryToUnit(ElectricApparentPowerUnit unit, [NotNullWhen(true)] out E
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricApparentPowerUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricApparentPowerUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricApparentPowerUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricApparentPowerUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricApparentPowerUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
index 23e11dcc23..bb6062d518 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCapacitance.g.cs
@@ -707,7 +707,7 @@ public double As(ElectricCapacitanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -799,30 +799,6 @@ private bool TryToUnit(ElectricCapacitanceUnit unit, [NotNullWhen(true)] out Ele
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricCapacitanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCapacitanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricCapacitanceUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCapacitanceUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricCapacitanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
index a1e0889a9e..6576034c1b 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs
@@ -796,7 +796,7 @@ public double As(ElectricChargeUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -896,30 +896,6 @@ private bool TryToUnit(ElectricChargeUnit unit, [NotNullWhen(true)] out Electric
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricChargeUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricChargeUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
index 4e05e910d1..faad9c5866 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs
@@ -611,7 +611,7 @@ public double As(ElectricChargeDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -691,30 +691,6 @@ private bool TryToUnit(ElectricChargeDensityUnit unit, [NotNullWhen(true)] out E
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricChargeDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricChargeDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricChargeDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
index 65754fc494..57fafb95de 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs
@@ -851,7 +851,7 @@ public double As(ElectricConductanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -961,30 +961,6 @@ private bool TryToUnit(ElectricConductanceUnit unit, [NotNullWhen(true)] out Ele
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricConductanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricConductanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
index b3d2d58156..7efd468f4e 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs
@@ -702,7 +702,7 @@ public double As(ElectricConductivityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -792,30 +792,6 @@ private bool TryToUnit(ElectricConductivityUnit unit, [NotNullWhen(true)] out El
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricConductivityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricConductivityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricConductivityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
index a331f270bb..497755cc74 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs
@@ -778,7 +778,7 @@ public double As(ElectricCurrentUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -874,30 +874,6 @@ private bool TryToUnit(ElectricCurrentUnit unit, [NotNullWhen(true)] out Electri
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricCurrentUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricCurrentUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
index 3be252f536..20cb61261b 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs
@@ -643,7 +643,7 @@ public double As(ElectricCurrentDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -727,30 +727,6 @@ private bool TryToUnit(ElectricCurrentDensityUnit unit, [NotNullWhen(true)] out
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricCurrentDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricCurrentDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
index 1280573afa..b5e5db4df3 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs
@@ -715,7 +715,7 @@ public double As(ElectricCurrentGradientUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -807,30 +807,6 @@ private bool TryToUnit(ElectricCurrentGradientUnit unit, [NotNullWhen(true)] out
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricCurrentGradientUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricCurrentGradientUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricCurrentGradientUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
index bd9198ec6a..7248325221 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs
@@ -611,7 +611,7 @@ public double As(ElectricFieldUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -691,30 +691,6 @@ private bool TryToUnit(ElectricFieldUnit unit, [NotNullWhen(true)] out ElectricF
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricFieldUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricFieldUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricFieldUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs
index 9bfc7824bd..cf96f1d46c 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricImpedance.g.cs
@@ -724,7 +724,7 @@ public double As(ElectricImpedanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -818,30 +818,6 @@ private bool TryToUnit(ElectricImpedanceUnit unit, [NotNullWhen(true)] out Elect
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricImpedanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricImpedanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricImpedanceUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricImpedanceUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricImpedanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
index ca4bb64b35..1f6e9dba86 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs
@@ -675,7 +675,7 @@ public double As(ElectricInductanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -763,30 +763,6 @@ private bool TryToUnit(ElectricInductanceUnit unit, [NotNullWhen(true)] out Elec
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricInductanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricInductanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricInductanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
index c967748047..58622dfb77 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs
@@ -723,7 +723,7 @@ public double As(ElectricPotentialUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -813,30 +813,6 @@ private bool TryToUnit(ElectricPotentialUnit unit, [NotNullWhen(true)] out Elect
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricPotentialUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricPotentialUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
index f260c75ae9..ca0cc9092f 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs
@@ -912,7 +912,7 @@ public double As(ElectricPotentialChangeRateUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1030,30 +1030,6 @@ private bool TryToUnit(ElectricPotentialChangeRateUnit unit, [NotNullWhen(true)]
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricPotentialChangeRateUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricPotentialChangeRateUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricPotentialChangeRateUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs
index f95fa43575..dbc88dd504 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactance.g.cs
@@ -723,7 +723,7 @@ public double As(ElectricReactanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -817,30 +817,6 @@ private bool TryToUnit(ElectricReactanceUnit unit, [NotNullWhen(true)] out Elect
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricReactanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricReactanceUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactanceUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricReactanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs
index 2de46419a9..fc20496b12 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactiveEnergy.g.cs
@@ -640,7 +640,7 @@ public double As(ElectricReactiveEnergyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -724,30 +724,6 @@ private bool TryToUnit(ElectricReactiveEnergyUnit unit, [NotNullWhen(true)] out
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricReactiveEnergyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactiveEnergyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricReactiveEnergyUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactiveEnergyUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricReactiveEnergyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs
index ce85f123d2..0770e7eb3d 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricReactivePower.g.cs
@@ -659,7 +659,7 @@ public double As(ElectricReactivePowerUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -745,30 +745,6 @@ private bool TryToUnit(ElectricReactivePowerUnit unit, [NotNullWhen(true)] out E
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricReactivePowerUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactivePowerUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricReactivePowerUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricReactivePowerUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricReactivePowerUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
index 0ea2926dff..1f324aebe4 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs
@@ -734,7 +734,7 @@ public double As(ElectricResistanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -828,30 +828,6 @@ private bool TryToUnit(ElectricResistanceUnit unit, [NotNullWhen(true)] out Elec
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricResistanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricResistanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
index 08b3034f2f..2a4a34bebe 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs
@@ -830,7 +830,7 @@ public double As(ElectricResistivityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -936,30 +936,6 @@ private bool TryToUnit(ElectricResistivityUnit unit, [NotNullWhen(true)] out Ele
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricResistivityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricResistivityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricResistivityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
index dc490b390b..9c94bd6b0d 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs
@@ -643,7 +643,7 @@ public double As(ElectricSurfaceChargeDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -727,30 +727,6 @@ private bool TryToUnit(ElectricSurfaceChargeDensityUnit unit, [NotNullWhen(true)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricSurfaceChargeDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSurfaceChargeDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricSurfaceChargeDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs
index d1dd42d07f..df9851204a 100644
--- a/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ElectricSusceptance.g.cs
@@ -851,7 +851,7 @@ public double As(ElectricSusceptanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -961,30 +961,6 @@ private bool TryToUnit(ElectricSusceptanceUnit unit, [NotNullWhen(true)] out Ele
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ElectricSusceptanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSusceptanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is ElectricSusceptanceUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ElectricSusceptanceUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ElectricSusceptanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
index 6e3e1a04bf..f3d3627d32 100644
--- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs
@@ -1327,7 +1327,7 @@ public double As(EnergyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1485,30 +1485,6 @@ private bool TryToUnit(EnergyUnit unit, [NotNullWhen(true)] out Energy? converte
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not EnergyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(EnergyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
index da2d4b638c..a56bb210f8 100644
--- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs
@@ -795,7 +795,7 @@ public double As(EnergyDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -897,30 +897,6 @@ private bool TryToUnit(EnergyDensityUnit unit, [NotNullWhen(true)] out EnergyDen
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not EnergyDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EnergyDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(EnergyDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
index e1e1545fc6..d780ee3cba 100644
--- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs
@@ -729,7 +729,7 @@ public double As(EntropyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -821,30 +821,6 @@ private bool TryToUnit(EntropyUnit unit, [NotNullWhen(true)] out Entropy? conver
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not EntropyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(EntropyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(EntropyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs
index b7d8f55957..22b2504e3f 100644
--- a/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/FluidResistance.g.cs
@@ -899,7 +899,7 @@ public double As(FluidResistanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1015,30 +1015,6 @@ private bool TryToUnit(FluidResistanceUnit unit, [NotNullWhen(true)] out FluidRe
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not FluidResistanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FluidResistanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is FluidResistanceUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FluidResistanceUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(FluidResistanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs
index 905b672b4a..bb9104bc02 100644
--- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs
@@ -950,7 +950,7 @@ public double As(ForceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1060,30 +1060,6 @@ private bool TryToUnit(ForceUnit unit, [NotNullWhen(true)] out Force? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ForceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ForceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
index 37ef54fe3f..469ecafdcb 100644
--- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs
@@ -843,7 +843,7 @@ public double As(ForceChangeRateUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -951,30 +951,6 @@ private bool TryToUnit(ForceChangeRateUnit unit, [NotNullWhen(true)] out ForceCh
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ForceChangeRateUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForceChangeRateUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ForceChangeRateUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
index 2749cdb6a7..5128cdb7ea 100644
--- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs
@@ -1281,7 +1281,7 @@ public double As(ForcePerLengthUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1435,30 +1435,6 @@ private bool TryToUnit(ForcePerLengthUnit unit, [NotNullWhen(true)] out ForcePer
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ForcePerLengthUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ForcePerLengthUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ForcePerLengthUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
index ca09928825..f0d46a9591 100644
--- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs
@@ -795,7 +795,7 @@ public double As(FrequencyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -897,30 +897,6 @@ private bool TryToUnit(FrequencyUnit unit, [NotNullWhen(true)] out Frequency? co
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not FrequencyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FrequencyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(FrequencyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
index d1e24ea670..4e28cd5ab1 100644
--- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs
@@ -659,7 +659,7 @@ public double As(FuelEfficiencyUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -745,30 +745,6 @@ private bool TryToUnit(FuelEfficiencyUnit unit, [NotNullWhen(true)] out FuelEffi
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not FuelEfficiencyUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(FuelEfficiencyUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(FuelEfficiencyUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
index bec79ebf22..4d3cb3c319 100644
--- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs
@@ -1003,7 +1003,7 @@ public double As(HeatFluxUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1131,30 +1131,6 @@ private bool TryToUnit(HeatFluxUnit unit, [NotNullWhen(true)] out HeatFlux? conv
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not HeatFluxUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatFluxUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(HeatFluxUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
index 971fe171a0..4c4be043b7 100644
--- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs
@@ -688,7 +688,7 @@ public double As(HeatTransferCoefficientUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -778,30 +778,6 @@ private bool TryToUnit(HeatTransferCoefficientUnit unit, [NotNullWhen(true)] out
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not HeatTransferCoefficientUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(HeatTransferCoefficientUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(HeatTransferCoefficientUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
index 46a8c6dbef..c048db2e45 100644
--- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs
@@ -670,7 +670,7 @@ public double As(IlluminanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -756,30 +756,6 @@ private bool TryToUnit(IlluminanceUnit unit, [NotNullWhen(true)] out Illuminance
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not IlluminanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IlluminanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(IlluminanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
index d235d81c4f..2ea43d20ff 100644
--- a/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Impulse.g.cs
@@ -800,7 +800,7 @@ public double As(ImpulseUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -904,30 +904,6 @@ private bool TryToUnit(ImpulseUnit unit, [NotNullWhen(true)] out Impulse? conver
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not ImpulseUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(ImpulseUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(ImpulseUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs
index 396b29890f..5a90545f58 100644
--- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs
@@ -1202,7 +1202,7 @@ public double As(InformationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1358,30 +1358,6 @@ private bool TryToUnit(InformationUnit unit, [NotNullWhen(true)] out Information
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not InformationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(InformationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(InformationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
index 05f5023fca..158c788ad1 100644
--- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs
@@ -816,7 +816,7 @@ public double As(IrradianceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -922,30 +922,6 @@ private bool TryToUnit(IrradianceUnit unit, [NotNullWhen(true)] out Irradiance?
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not IrradianceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradianceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(IrradianceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
index 66653eecf9..d9b87ede73 100644
--- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs
@@ -739,7 +739,7 @@ public double As(IrradiationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -835,30 +835,6 @@ private bool TryToUnit(IrradiationUnit unit, [NotNullWhen(true)] out Irradiation
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not IrradiationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(IrradiationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(IrradiationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
index 82f1e4f09d..3cea22d839 100644
--- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs
@@ -779,7 +779,7 @@ public double As(JerkUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -879,30 +879,6 @@ private bool TryToUnit(JerkUnit unit, [NotNullWhen(true)] out Jerk? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not JerkUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(JerkUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(JerkUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
index 020c44f495..56b9f970c6 100644
--- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs
@@ -771,7 +771,7 @@ public double As(KinematicViscosityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -867,30 +867,6 @@ private bool TryToUnit(KinematicViscosityUnit unit, [NotNullWhen(true)] out Kine
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not KinematicViscosityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(KinematicViscosityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(KinematicViscosityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs
index 0c348471bc..3d7240a0a3 100644
--- a/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LeakRate.g.cs
@@ -659,7 +659,7 @@ public double As(LeakRateUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -745,30 +745,6 @@ private bool TryToUnit(LeakRateUnit unit, [NotNullWhen(true)] out LeakRate? conv
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LeakRateUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LeakRateUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(Enum unit)
- {
- if (!(unit is LeakRateUnit typedUnit))
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LeakRateUnit)} is supported.", nameof(unit));
-
- return ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LeakRateUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs
index 414fe3f789..048fa618a6 100644
--- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs
@@ -1422,7 +1422,7 @@ public double As(LengthUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1584,30 +1584,6 @@ private bool TryToUnit(LengthUnit unit, [NotNullWhen(true)] out Length? converte
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LengthUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LengthUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LengthUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs
index e7bb8464fc..ba08eaf247 100644
--- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs
@@ -625,7 +625,7 @@ public double As(LevelUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -707,30 +707,6 @@ private bool TryToUnit(LevelUnit unit, [NotNullWhen(true)] out Level? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LevelUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LevelUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LevelUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
index 3fc8d62ed5..a092415240 100644
--- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs
@@ -929,7 +929,7 @@ public double As(LinearDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1043,30 +1043,6 @@ private bool TryToUnit(LinearDensityUnit unit, [NotNullWhen(true)] out LinearDen
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LinearDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LinearDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
index c21d2bfad6..2723f35fcb 100644
--- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs
@@ -995,7 +995,7 @@ public double As(LinearPowerDensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1123,30 +1123,6 @@ private bool TryToUnit(LinearPowerDensityUnit unit, [NotNullWhen(true)] out Line
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LinearPowerDensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LinearPowerDensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LinearPowerDensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
index e4e5427444..c1972ea16e 100644
--- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs
@@ -766,7 +766,7 @@ public double As(LuminanceUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -864,30 +864,6 @@ private bool TryToUnit(LuminanceUnit unit, [NotNullWhen(true)] out Luminance? co
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LuminanceUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminanceUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LuminanceUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
index fa05cd6d8b..77d93c9402 100644
--- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs
@@ -819,7 +819,7 @@ public double As(LuminosityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -925,30 +925,6 @@ private bool TryToUnit(LuminosityUnit unit, [NotNullWhen(true)] out Luminosity?
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LuminosityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminosityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LuminosityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
index 68c29ad4c7..314a6085e6 100644
--- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs
@@ -629,7 +629,7 @@ public double As(LuminousFluxUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -709,30 +709,6 @@ private bool TryToUnit(LuminousFluxUnit unit, [NotNullWhen(true)] out LuminousFl
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LuminousFluxUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousFluxUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LuminousFluxUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
index 09c340b3e2..00718ad4c8 100644
--- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs
@@ -629,7 +629,7 @@ public double As(LuminousIntensityUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -709,30 +709,6 @@ private bool TryToUnit(LuminousIntensityUnit unit, [NotNullWhen(true)] out Lumin
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not LuminousIntensityUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(LuminousIntensityUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(LuminousIntensityUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
index d0eb1a8951..6bcb0331a4 100644
--- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs
@@ -691,7 +691,7 @@ public double As(MagneticFieldUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -781,30 +781,6 @@ private bool TryToUnit(MagneticFieldUnit unit, [NotNullWhen(true)] out MagneticF
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MagneticFieldUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFieldUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MagneticFieldUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
index 1c2c629fb6..f47e248f44 100644
--- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs
@@ -611,7 +611,7 @@ public double As(MagneticFluxUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -691,30 +691,6 @@ private bool TryToUnit(MagneticFluxUnit unit, [NotNullWhen(true)] out MagneticFl
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MagneticFluxUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagneticFluxUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MagneticFluxUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
index 806958dec8..e70c7c1876 100644
--- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs
@@ -611,7 +611,7 @@ public double As(MagnetizationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -691,30 +691,6 @@ private bool TryToUnit(MagnetizationUnit unit, [NotNullWhen(true)] out Magnetiza
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MagnetizationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MagnetizationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MagnetizationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
index c6596c311d..560f31c220 100644
--- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs
@@ -1204,7 +1204,7 @@ public double As(MassUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1344,30 +1344,6 @@ private bool TryToUnit(MassUnit unit, [NotNullWhen(true)] out Mass? converted)
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MassUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
index 0d57d2b4c7..9432eef0e1 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs
@@ -1418,7 +1418,7 @@ public double As(MassConcentrationUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1594,30 +1594,6 @@ private bool TryToUnit(MassConcentrationUnit unit, [NotNullWhen(true)] out MassC
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassConcentrationUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassConcentrationUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MassConcentrationUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
index fd5fc83419..e97f523100 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs
@@ -1194,7 +1194,7 @@ public double As(MassFlowUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1338,30 +1338,6 @@ private bool TryToUnit(MassFlowUnit unit, [NotNullWhen(true)] out MassFlow? conv
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassFlowUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFlowUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MassFlowUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
index dbe90db2d0..23541133d4 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs
@@ -809,7 +809,7 @@ public double As(MassFluxUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -911,30 +911,6 @@ private bool TryToUnit(MassFluxUnit unit, [NotNullWhen(true)] out MassFlux? conv
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassFluxUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFluxUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MassFluxUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
index 0f9082e482..b50e25507b 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs
@@ -976,7 +976,7 @@ public double As(MassFractionUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1102,30 +1102,6 @@ private bool TryToUnit(MassFractionUnit unit, [NotNullWhen(true)] out MassFracti
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassFractionUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassFractionUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity.ToUnit(MassFractionUnit unit) => ToUnit(unit);
-
- #endregion
-
#endregion
#region ToString Methods
diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
index ac2b1c4b20..1197a6cf56 100644
--- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs
@@ -1040,7 +1040,7 @@ public double As(MassMomentOfInertiaUnit unit)
return ToUnit(unit).Value;
}
- ///
+ ///
public double As(UnitKey unitKey)
{
return As(unitKey.ToUnit());
@@ -1174,30 +1174,6 @@ private bool TryToUnit(MassMomentOfInertiaUnit unit, [NotNullWhen(true)] out Mas
return true;
}
- #region Explicit implementations
-
- double IQuantity.As(Enum unit)
- {
- if (unit is not MassMomentOfInertiaUnit typedUnit)
- throw new ArgumentException($"The given unit is of type {unit.GetType()}. Only {typeof(MassMomentOfInertiaUnit)} is supported.", nameof(unit));
-
- return As(typedUnit);
- }
-
- ///
- IQuantity IQuantity.ToUnit(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 ToUnit(typedUnit, DefaultConversionFunctions);
- }
-
- ///
- IQuantity IQuantity