diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
index dfaa53af3d..09bf734e78 100644
--- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
+++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
@@ -60,10 +60,10 @@ namespace UnitsNet
/// ");
Writer.WLIfText(1, GetObsoleteAttributeOrNull(_quantity));
- Writer.WL(@$"
+ Writer.W(@$"
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct {_quantity.Name} :");
+ public readonly partial struct {_quantity.Name}");
GenerateInterfaceExtensions();
Writer.WL($@"
@@ -103,33 +103,26 @@ namespace UnitsNet
private void GenerateInterfaceExtensions()
{
- // generate the base interface (either IVectorQuantity, IAffineQuantity or ILogarithmicQuantity)
+ Writer.W($" : IQuantity<{_quantity.Name}, {_unitEnumName}>, ");
+
+ // generate ILogarithmicQuantity, IAffineQuantity or ILinearQuantity
if (_quantity.Logarithmic)
{
- Writer.WL(@$"
- ILogarithmicQuantity<{_quantity.Name}, {_unitEnumName}>,");
+ Writer.WL($"ILogarithmicQuantity<{_quantity.Name}>");
}
else if (!string.IsNullOrEmpty(_quantity.AffineOffsetType))
{
- Writer.WL(@$"
- IAffineQuantity<{_quantity.Name}, {_unitEnumName}, {_quantity.AffineOffsetType}>,");
+ Writer.WL($"IAffineQuantity<{_quantity.Name}, {_quantity.AffineOffsetType}>");
}
- else // the default quantity type implements the IVectorQuantity interface
+ else // the default quantity type implements the ILinearQuantity interface
{
- Writer.WL(@$"
- IArithmeticQuantity<{_quantity.Name}, {_unitEnumName}>,");
- }
-
- Writer.WL(@"
-#if NET7_0_OR_GREATER");
- if (!_quantity.IsAffine)
- {
- Writer.WL($@"
- IDivisionOperators<{_quantity.Name}, {_quantity.Name}, double>,");
+ Writer.WL($"ILinearQuantity<{_quantity.Name}>");
}
if (_quantity.Relations.Any(r => r.Operator is "*" or "/"))
{
+ Writer.WL(@"
+#if NET7_0_OR_GREATER");
foreach (QuantityRelation relation in _quantity.Relations)
{
if (relation.LeftQuantity != _quantity) continue;
@@ -137,28 +130,20 @@ private void GenerateInterfaceExtensions()
{
case "*":
Writer.W(@"
- IMultiplyOperators");
+ , IMultiplyOperators");
break;
case "/":
Writer.W(@"
- IDivisionOperators");
+ , IDivisionOperators");
break;
default:
continue;
}
-
- Writer.WL($"<{relation.LeftQuantity.Name}, {relation.RightQuantity.Name}, {relation.ResultQuantity.Name}>,");
+ Writer.WL($"<{relation.LeftQuantity.Name}, {relation.RightQuantity.Name}, {relation.ResultQuantity.Name}>");
}
+ Writer.WL(@$"
+#endif");
}
-
- Writer.WL(@$"
- IComparisonOperators<{_quantity.Name}, {_quantity.Name}, bool>,
- IParsable<{_quantity.Name}>,
-#endif
- IComparable,
- IComparable<{_quantity.Name}>,
- IEquatable<{_quantity.Name}>,
- IFormattable");
}
private void GenerateQuantityInfo()
diff --git a/UnitsNet.Tests/CustomQuantities/HowMuch.cs b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
index 7a59f20a8d..c6485a65d9 100644
--- a/UnitsNet.Tests/CustomQuantities/HowMuch.cs
+++ b/UnitsNet.Tests/CustomQuantities/HowMuch.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics.CodeAnalysis;
using UnitsNet.Units;
namespace UnitsNet.Tests.CustomQuantities
@@ -100,6 +101,118 @@ QuantityInfo IQuantity.QuantityInfo
Enum IQuantity.Unit => Unit;
#endif
+
+ #endregion
+
+
+ #region Equality / IComparable
+
+ /// Returns true if less or equal to.
+ public static bool operator <=(HowMuch left, HowMuch right)
+ {
+ return left.Value <= right.ToUnit(left.Unit).Value;
+ }
+
+ /// Returns true if greater than or equal to.
+ public static bool operator >=(HowMuch left, HowMuch right)
+ {
+ return left.Value >= right.ToUnit(left.Unit).Value;
+ }
+
+ /// Returns true if less than.
+ public static bool operator <(HowMuch left, HowMuch right)
+ {
+ return left.Value < right.ToUnit(left.Unit).Value;
+ }
+
+ /// Returns true if greater than.
+ public static bool operator >(HowMuch left, HowMuch right)
+ {
+ return left.Value > right.ToUnit(left.Unit).Value;
+ }
+
+ // We use obsolete attribute to communicate the preferred equality members to use.
+ // CS0809: Obsolete member 'memberA' overrides non-obsolete member 'memberB'.
+#pragma warning disable CS0809
+
+ /// Indicates strict equality of two quantities, where both and are exactly equal.
+ [Obsolete(
+ "For null checks, use `x is null` syntax to not invoke overloads. For equality checks, use Equals(HowMuch other, HowMuch tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
+ public static bool operator ==(HowMuch left, HowMuch right)
+ {
+ return left.Equals(right);
+ }
+
+ /// Indicates strict inequality of two quantities, where both and are exactly equal.
+ [Obsolete(
+ "For null checks, use `x is null` syntax to not invoke overloads. For equality checks, use Equals(HowMuch other, HowMuch tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
+ public static bool operator !=(HowMuch left, HowMuch right)
+ {
+ return !(left == right);
+ }
+
+ ///
+ /// Indicates strict equality of two quantities, where both and are exactly equal.
+ [Obsolete(
+ "Use Equals(HowMuch other, HowMuch tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
+ public override bool Equals(object? obj)
+ {
+ if (obj is null || !(obj is HowMuch otherQuantity))
+ return false;
+
+ return Equals(otherQuantity);
+ }
+
+ ///
+ /// Indicates strict equality of two quantities, where both and are exactly equal.
+ [Obsolete(
+ "Use Equals(HowMuch other, HowMuch tolerance) instead, to check equality across units and to specify the max tolerance for rounding errors due to floating-point arithmetic when converting between units.")]
+ public bool Equals(HowMuch other)
+ {
+ return new { Value, Unit }.Equals(new { other.Value, other.Unit });
+ }
+
+#pragma warning restore CS0809
+
+ public override int GetHashCode()
+ {
+ return Comparison.GetHashCode(Unit, Value);
+ }
+
+ public int CompareTo(object? obj)
+ {
+ if (obj is null) throw new ArgumentNullException(nameof(obj));
+ if (!(obj is HowMuch otherQuantity)) throw new ArgumentException("Expected type HowMuch.", nameof(obj));
+
+ return CompareTo(otherQuantity);
+ }
+
+ public int CompareTo(HowMuch other)
+ {
+ return Value.CompareTo(other.ToUnit(Unit).Value);
+ }
+
+ #endregion
+
+ #region IParsable
+
+ public static HowMuch Parse(string str, IFormatProvider? provider)
+ {
+ return UnitsNetSetup.Default.QuantityParser.Parse(
+ str,
+ provider,
+ From);
+ }
+
+ public static bool TryParse([NotNullWhen(true)] string? str, IFormatProvider? provider, out HowMuch result)
+ {
+ return UnitsNetSetup.Default.QuantityParser.TryParse(
+ str,
+ provider,
+ From,
+ out result);
+ }
+
#endregion
}
}
diff --git a/UnitsNet/Extensions/LogarithmicQuantityExtensions.cs b/UnitsNet/Extensions/LogarithmicQuantityExtensions.cs
index 7f28720e05..af0f90853c 100644
--- a/UnitsNet/Extensions/LogarithmicQuantityExtensions.cs
+++ b/UnitsNet/Extensions/LogarithmicQuantityExtensions.cs
@@ -176,7 +176,7 @@ public static TQuantity Sum(this IEnumerable source
/// logarithmic space.
///
public static TQuantity Sum(this IEnumerable quantities, TUnit targetUnit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
if (quantities is null)
@@ -224,7 +224,7 @@ public static TQuantity Sum(this IEnumerable quanti
/// logarithmic space.
///
public static TQuantity Sum(this IEnumerable source, Func selector, TUnit targetUnit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
return source.Select(selector).Sum(targetUnit);
@@ -312,7 +312,7 @@ public static TQuantity ArithmeticMean(this IEnumerable
public static TQuantity ArithmeticMean(this IEnumerable quantities, TUnit unit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
if (quantities is null)
@@ -363,7 +363,7 @@ public static TQuantity ArithmeticMean(this IEnumerable
public static TQuantity ArithmeticMean(this IEnumerable source, Func selector, TUnit targetUnit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
return ArithmeticMean(source.Select(selector), targetUnit);
@@ -448,7 +448,7 @@ public static TQuantity GeometricMean(this IEnumerable
public static TQuantity GeometricMean(this IEnumerable quantities, TUnit targetUnit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
if (quantities is null)
@@ -494,7 +494,7 @@ public static TQuantity GeometricMean(this IEnumerable
public static TQuantity GeometricMean(this IEnumerable source, Func selector, TUnit targetUnit)
- where TQuantity : ILogarithmicQuantity
+ where TQuantity : ILogarithmicQuantity, IQuantity
where TUnit : struct, Enum
{
return source.Select(selector).GeometricMean(targetUnit);
diff --git a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
index d9f4ac2066..521cf9d4ee 100644
--- a/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AbsorbedDoseOfIonizingRadiation.g.cs
@@ -39,17 +39,7 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct AbsorbedDoseOfIonizingRadiation :
- IArithmeticQuantity,
-#if NET7_0_OR_GREATER
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
-#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
+ public readonly partial struct AbsorbedDoseOfIonizingRadiation : IQuantity, ILinearQuantity
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
index 83b6c6add3..c6449c20ca 100644
--- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs
@@ -36,22 +36,14 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Acceleration :
- IArithmeticQuantity,
+ public readonly partial struct Acceleration : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IDivisionOperators
+ , IMultiplyOperators
+ , IDivisionOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
index 939a52084e..ba82b3828a 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs
@@ -36,23 +36,15 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct AmountOfSubstance :
- IArithmeticQuantity,
+ public readonly partial struct AmountOfSubstance : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IDivisionOperators,
- IDivisionOperators,
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
+ , IDivisionOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IDivisionOperators
+ , IDivisionOperators
+ , IDivisionOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
index 0db3066f16..e8a32d0748 100644
--- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs
@@ -36,17 +36,7 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct AmplitudeRatio :
- ILogarithmicQuantity,
-#if NET7_0_OR_GREATER
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
-#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
+ public readonly partial struct AmplitudeRatio : IQuantity, ILogarithmicQuantity
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
index bb2822e031..4b17cc43f3 100644
--- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs
@@ -36,20 +36,12 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Angle :
- IArithmeticQuantity,
+ public readonly partial struct Angle : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IDivisionOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IDivisionOperators
+ , IDivisionOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
index 971074a1b1..bd07281614 100644
--- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs
@@ -36,33 +36,25 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Area :
- IArithmeticQuantity,
+ public readonly partial struct Area : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IDivisionOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IDivisionOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IDivisionOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IDivisionOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
index 2b662909c4..760f8151b6 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs
@@ -36,18 +36,10 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct AreaDensity :
- IArithmeticQuantity,
+ public readonly partial struct AreaDensity : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
index 77fd67fa9f..f2d526aa0a 100644
--- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs
@@ -36,19 +36,11 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct AreaMomentOfInertia :
- IArithmeticQuantity,
+ public readonly partial struct AreaMomentOfInertia : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IDivisionOperators,
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
+ , IDivisionOperators
+ , IDivisionOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
index ef08cdfb3d..b14102381e 100644
--- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs
@@ -39,17 +39,7 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct BitRate :
- IArithmeticQuantity,
-#if NET7_0_OR_GREATER
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
-#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
+ public readonly partial struct BitRate : IQuantity, ILinearQuantity
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
index fc7b253fa6..79d072afca 100644
--- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs
@@ -36,19 +36,11 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct BrakeSpecificFuelConsumption :
- IArithmeticQuantity,
+ public readonly partial struct BrakeSpecificFuelConsumption : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
index 25671ba248..3fc937a95c 100644
--- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs
@@ -36,18 +36,10 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct CoefficientOfThermalExpansion :
- IArithmeticQuantity,
+ public readonly partial struct CoefficientOfThermalExpansion : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
index 6aafee49bf..e816f03eaf 100644
--- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs
@@ -36,17 +36,7 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Compressibility :
- IArithmeticQuantity,
-#if NET7_0_OR_GREATER
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
-#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
+ public readonly partial struct Compressibility : IQuantity, ILinearQuantity
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
index 43aa68b621..bbe670f0e9 100644
--- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs
@@ -39,24 +39,16 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Density :
- IArithmeticQuantity,
+ public readonly partial struct Density : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
index d2ee657131..84fefaf708 100644
--- a/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DoseAreaProduct.g.cs
@@ -39,17 +39,7 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct DoseAreaProduct :
- IArithmeticQuantity,
-#if NET7_0_OR_GREATER
- IDivisionOperators,
- IComparisonOperators,
- IParsable,
-#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
+ public readonly partial struct DoseAreaProduct : IQuantity, ILinearQuantity
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
index 53509ba4eb..baa75f13f6 100644
--- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs
@@ -36,32 +36,24 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct Duration :
- IArithmeticQuantity,
+ public readonly partial struct Duration : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IMultiplyOperators,
- IComparisonOperators,
- IParsable,
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
+ , IMultiplyOperators
#endif
- IComparable,
- IComparable,
- IEquatable,
- IFormattable
{
///
/// The numeric value this quantity was constructed with.
diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
index 7f0bc8028f..c5e6b6c601 100644
--- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs
@@ -39,19 +39,11 @@ namespace UnitsNet
///
[DataContract]
[DebuggerTypeProxy(typeof(QuantityDisplay))]
- public readonly partial struct DynamicViscosity :
- IArithmeticQuantity,
+ public readonly partial struct DynamicViscosity : IQuantity, ILinearQuantity
#if NET7_0_OR_GREATER
- IDivisionOperators,
- IDivisionOperators,
- IDivisionOperators,
- IComparisonOperators,
- IParsable