diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index c4b7825a47..b4c1faea65 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -64,7 +64,7 @@ namespace UnitsNet Writer.WLIfText(1, GetObsoleteAttributeOrNull(_quantity)); Writer.W(@$" [DataContract] - public readonly partial struct {_quantity.Name} : IQuantity<{_unitEnumName}>, "); + public readonly partial struct {_quantity.Name} : {(_quantity.GenerateArithmetic ? "IArithmeticQuantity" : "IQuantity")}<{_quantity.Name}, {_unitEnumName}, {_quantity.ValueType}>, "); if (_quantity.ValueType == "decimal") { Writer.W("IDecimalQuantity, "); @@ -239,9 +239,19 @@ private void GenerateStaticProperties() /// Gets an instance of this quantity with a value of 0 in the base unit {_quantity.BaseUnit}. /// public static {_quantity.Name} Zero {{ get; }} +"); - #endregion + if (_quantity.GenerateArithmetic) + { + Writer.WL($@" + /// + public static {_quantity.Name} AdditiveIdentity => Zero; "); + } + + Writer.WL($@" + #endregion + "); } private void GenerateProperties() diff --git a/UnitsNet.Tests/GenericMathExtensionsTests.cs b/UnitsNet.Tests/GenericMathExtensionsTests.cs new file mode 100644 index 0000000000..cea65470bb --- /dev/null +++ b/UnitsNet.Tests/GenericMathExtensionsTests.cs @@ -0,0 +1,37 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +#if NET7_0_OR_GREATER +using UnitsNet.GenericMath; +using Xunit; + +namespace UnitsNet.Tests; + +public class GenericMathExtensionsTests +{ + [Fact] + public void CanCalcSum() + { + Length[] values = { Length.FromCentimeters(100), Length.FromCentimeters(200) }; + + Assert.Equal(Length.FromCentimeters(300), values.Sum()); + } + + [Fact] + public void CanCalcAverage_ForQuantitiesWithDoubleValueType() + { + Length[] values = { Length.FromCentimeters(100), Length.FromCentimeters(200) }; + + Assert.Equal(Length.FromCentimeters(150), values.Average()); + } + + [Fact] + public void CanCalcAverage_ForQuantitiesWithDecimalValueType() + { + Information[] values = { Information.FromBytes(100), Information.FromBytes(200) }; + + Assert.Equal(Information.FromBytes(150), values.Average()); + } +} + +#endif diff --git a/UnitsNet.Tests/UnitsNet.Tests.csproj b/UnitsNet.Tests/UnitsNet.Tests.csproj index 01444d706d..67cd43b1de 100644 --- a/UnitsNet.Tests/UnitsNet.Tests.csproj +++ b/UnitsNet.Tests/UnitsNet.Tests.csproj @@ -1,7 +1,7 @@  - net6.0;net48 + net7.0;net48 latest true CS0618 diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 10a9c1a3f3..71dcfc67d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Acceleration, in physics, is the rate at which the velocity of an object changes over time. An object's acceleration is the net result of any and all forces acting on the object, as described by Newton's Second Law. The SI unit for acceleration is the Meter per second squared (m/s²). Accelerations are vector quantities (they have magnitude and direction) and add according to the parallelogram law. As a vector, the calculated net force is equal to the product of the object's mass (a scalar quantity) and the acceleration. /// [DataContract] - public readonly partial struct Acceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Acceleration : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,8 +141,11 @@ public Acceleration(double value, UnitSystem unitSystem) /// public static Acceleration Zero { get; } - #endregion + /// + public static Acceleration AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 01f9115756..eea0e12d3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Mole is the amount of substance containing Avagadro's Number (6.02 x 10 ^ 23) of real particles such as molecules,atoms, ions or radicals. /// [DataContract] - public readonly partial struct AmountOfSubstance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct AmountOfSubstance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -142,8 +142,11 @@ public AmountOfSubstance(double value, UnitSystem unitSystem) /// public static AmountOfSubstance Zero { get; } - #endregion + /// + public static AmountOfSubstance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index 5d9c147ee0..6b68414b1f 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The strength of a signal expressed in decibels (dB) relative to one volt RMS. /// [DataContract] - public readonly partial struct AmplitudeRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct AmplitudeRatio : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public AmplitudeRatio(double value, UnitSystem unitSystem) /// public static AmplitudeRatio Zero { get; } - #endregion + /// + public static AmplitudeRatio AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 35dbb2a5ac..61e25c4196 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. /// [DataContract] - public readonly partial struct Angle : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Angle : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -143,8 +143,11 @@ public Angle(double value, UnitSystem unitSystem) /// public static Angle Zero { get; } - #endregion + /// + public static Angle AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 834b66a4f2..ce9917baa2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A unit for expressing the integral of apparent power over time, equal to the product of 1 volt-ampere and 1 hour, or to 3600 joules. /// [DataContract] - public readonly partial struct ApparentEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ApparentEnergy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public ApparentEnergy(double value, UnitSystem unitSystem) /// public static ApparentEnergy Zero { get; } - #endregion + /// + public static ApparentEnergy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 8653aa4575..52e2285088 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Power engineers measure apparent power as the magnitude of the vector sum of active and reactive power. Apparent power is the product of the root-mean-square of voltage and current. /// [DataContract] - public readonly partial struct ApparentPower : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ApparentPower : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ApparentPower(double value, UnitSystem unitSystem) /// public static ApparentPower Zero { get; } - #endregion + /// + public static ApparentPower AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index dd71c089bc..0a00e2550f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Area is a quantity that expresses the extent of a two-dimensional surface or shape, or planar lamina, in the plane. Area can be understood as the amount of material with a given thickness that would be necessary to fashion a model of the shape, or the amount of paint necessary to cover the surface with a single coat.[1] It is the two-dimensional analog of the length of a curve (a one-dimensional concept) or the volume of a solid (a three-dimensional concept). /// [DataContract] - public readonly partial struct Area : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Area : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,8 +141,11 @@ public Area(double value, UnitSystem unitSystem) /// public static Area Zero { get; } - #endregion + /// + public static Area AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 20dfd4d304..6cbbe45cd7 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The area density of a two-dimensional object is calculated as the mass per unit area. For paper this is also called grammage. /// [DataContract] - public readonly partial struct AreaDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct AreaDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public AreaDensity(double value, UnitSystem unitSystem) /// public static AreaDensity Zero { get; } - #endregion + /// + public static AreaDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 4e6e567989..d6577e5d30 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A geometric property of an area that reflects how its points are distributed with regard to an axis. /// [DataContract] - public readonly partial struct AreaMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct AreaMomentOfInertia : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public AreaMomentOfInertia(double value, UnitSystem unitSystem) /// public static AreaMomentOfInertia Zero { get; } - #endregion + /// + public static AreaMomentOfInertia AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 2d0c7e693f..7d9029adba 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Bit_rate /// [DataContract] - public readonly partial struct BitRate : IQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct BitRate : IArithmeticQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -156,8 +156,11 @@ public BitRate(decimal value, UnitSystem unitSystem) /// public static BitRate Zero { get; } - #endregion + /// + public static BitRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index c3e720e792..2f349e2ecb 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Brake specific fuel consumption (BSFC) is a measure of the fuel efficiency of any prime mover that burns fuel and produces rotational, or shaft, power. It is typically used for comparing the efficiency of internal combustion engines with a shaft output. /// [DataContract] - public readonly partial struct BrakeSpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct BrakeSpecificFuelConsumption : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public BrakeSpecificFuelConsumption(double value, UnitSystem unitSystem) /// public static BrakeSpecificFuelConsumption Zero { get; } - #endregion + /// + public static BrakeSpecificFuelConsumption AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index 66108a7d99..cccf254368 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Capacitance /// [DataContract] - public readonly partial struct Capacitance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Capacitance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -137,8 +137,11 @@ public Capacitance(double value, UnitSystem unitSystem) /// public static Capacitance Zero { get; } - #endregion + /// + public static Capacitance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs index 3dde7f804d..3e75018447 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A unit that represents a fractional change in size in response to a change in temperature. /// [DataContract] - public readonly partial struct CoefficientOfThermalExpansion : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct CoefficientOfThermalExpansion : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public CoefficientOfThermalExpansion(double value, UnitSystem unitSystem) /// public static CoefficientOfThermalExpansion Zero { get; } - #endregion + /// + public static CoefficientOfThermalExpansion AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs index 4afa6d3cde..e965366524 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// /// [DataContract] - public readonly partial struct Compressibility : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Compressibility : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public Compressibility(double value, UnitSystem unitSystem) /// public static Compressibility Zero { get; } - #endregion + /// + public static Compressibility AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 562b9d5bb8..6196ea3180 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Density /// [DataContract] - public readonly partial struct Density : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Density : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -181,8 +181,11 @@ public Density(double value, UnitSystem unitSystem) /// public static Density Zero { get; } - #endregion + /// + public static Density AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index 0d91258e7b..36ef64fed4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Time is a dimension in which events can be ordered from the past through the present into the future, and also the measure of durations of events and the intervals between them. /// [DataContract] - public readonly partial struct Duration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Duration : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -138,8 +138,11 @@ public Duration(double value, UnitSystem unitSystem) /// public static Duration Zero { get; } - #endregion + /// + public static Duration AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 2150ca69d0..7341186c46 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Viscosity#Dynamic_.28shear.29_viscosity /// [DataContract] - public readonly partial struct DynamicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct DynamicViscosity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -140,8 +140,11 @@ public DynamicViscosity(double value, UnitSystem unitSystem) /// public static DynamicViscosity Zero { get; } - #endregion + /// + public static DynamicViscosity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 2d1dcc221c..4c37320694 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Electric admittance is a measure of how easily a circuit or device will allow a current to flow. It is defined as the inverse of impedance. The SI unit of admittance is the siemens (symbol S). /// [DataContract] - public readonly partial struct ElectricAdmittance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricAdmittance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ElectricAdmittance(double value, UnitSystem unitSystem) /// public static ElectricAdmittance Zero { get; } - #endregion + /// + public static ElectricAdmittance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 36b9a67a9a..22a34c7766 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electric_charge /// [DataContract] - public readonly partial struct ElectricCharge : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricCharge : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -135,8 +135,11 @@ public ElectricCharge(double value, UnitSystem unitSystem) /// public static ElectricCharge Zero { get; } - #endregion + /// + public static ElectricCharge AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index 30ac513bca..8c93da965a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Charge_density /// [DataContract] - public readonly partial struct ElectricChargeDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricChargeDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ElectricChargeDensity(double value, UnitSystem unitSystem) /// public static ElectricChargeDensity Zero { get; } - #endregion + /// + public static ElectricChargeDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index b33d4813c0..8e1c71f938 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistance_and_conductance /// [DataContract] - public readonly partial struct ElectricConductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricConductance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public ElectricConductance(double value, UnitSystem unitSystem) /// public static ElectricConductance Zero { get; } - #endregion + /// + public static ElectricConductance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index 5718108366..5dee91d567 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// [DataContract] - public readonly partial struct ElectricConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricConductivity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -136,8 +136,11 @@ public ElectricConductivity(double value, UnitSystem unitSystem) /// public static ElectricConductivity Zero { get; } - #endregion + /// + public static ElectricConductivity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index df17e0900f..7dc5fbfa3b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. /// [DataContract] - public readonly partial struct ElectricCurrent : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricCurrent : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -135,8 +135,11 @@ public ElectricCurrent(double value, UnitSystem unitSystem) /// public static ElectricCurrent Zero { get; } - #endregion + /// + public static ElectricCurrent AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 6d3bb4593a..2a0d07c524 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Current_density /// [DataContract] - public readonly partial struct ElectricCurrentDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricCurrentDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public ElectricCurrentDensity(double value, UnitSystem unitSystem) /// public static ElectricCurrentDensity Zero { get; } - #endregion + /// + public static ElectricCurrentDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index 577732eb7d..40d2ce444b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In electromagnetism, the current gradient describes how the current changes in time. /// [DataContract] - public readonly partial struct ElectricCurrentGradient : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricCurrentGradient : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ElectricCurrentGradient(double value, UnitSystem unitSystem) /// public static ElectricCurrentGradient Zero { get; } - #endregion + /// + public static ElectricCurrentGradient AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 6e17384f3f..7809de6fe8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electric_field /// [DataContract] - public readonly partial struct ElectricField : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricField : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ElectricField(double value, UnitSystem unitSystem) /// public static ElectricField Zero { get; } - #endregion + /// + public static ElectricField AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 39c37813fb..5ed2447816 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Inductance /// [DataContract] - public readonly partial struct ElectricInductance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricInductance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public ElectricInductance(double value, UnitSystem unitSystem) /// public static ElectricInductance Zero { get; } - #endregion + /// + public static ElectricInductance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 840b5cb912..041b123462 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In classical electromagnetism, the electric potential (a scalar quantity denoted by Φ, ΦE or V and also called the electric field potential or the electrostatic potential) at a point is the amount of electric potential energy that a unitary point charge would have when located at that point. /// [DataContract] - public readonly partial struct ElectricPotential : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricPotential : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,8 +132,11 @@ public ElectricPotential(double value, UnitSystem unitSystem) /// public static ElectricPotential Zero { get; } - #endregion + /// + public static ElectricPotential AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index f1151d4544..2f4e5a6dcc 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The Electric Potential of a system known to use Alternating Current. /// [DataContract] - public readonly partial struct ElectricPotentialAc : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricPotentialAc : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,8 +132,11 @@ public ElectricPotentialAc(double value, UnitSystem unitSystem) /// public static ElectricPotentialAc Zero { get; } - #endregion + /// + public static ElectricPotentialAc AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs index 12bd47e2a8..4f3a640775 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// ElectricPotential change rate is the ratio of the electric potential change to the time during which the change occurred (value of electric potential changes per unit time). /// [DataContract] - public readonly partial struct ElectricPotentialChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricPotentialChangeRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -147,8 +147,11 @@ public ElectricPotentialChangeRate(double value, UnitSystem unitSystem) /// public static ElectricPotentialChangeRate Zero { get; } - #endregion + /// + public static ElectricPotentialChangeRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 7ce7898c1b..a2bd0b9f52 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The Electric Potential of a system known to use Direct Current. /// [DataContract] - public readonly partial struct ElectricPotentialDc : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricPotentialDc : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,8 +132,11 @@ public ElectricPotentialDc(double value, UnitSystem unitSystem) /// public static ElectricPotentialDc Zero { get; } - #endregion + /// + public static ElectricPotentialDc AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index 2e69b277b8..0895f8712c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The electrical resistance of an electrical conductor is the opposition to the passage of an electric current through that conductor. /// [DataContract] - public readonly partial struct ElectricResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricResistance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public ElectricResistance(double value, UnitSystem unitSystem) /// public static ElectricResistance Zero { get; } - #endregion + /// + public static ElectricResistance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index 66e4dc877c..28116b891b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity /// [DataContract] - public readonly partial struct ElectricResistivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricResistivity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -144,8 +144,11 @@ public ElectricResistivity(double value, UnitSystem unitSystem) /// public static ElectricResistivity Zero { get; } - #endregion + /// + public static ElectricResistivity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs index f4fc4e817d..1400483cea 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Charge_density /// [DataContract] - public readonly partial struct ElectricSurfaceChargeDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ElectricSurfaceChargeDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public ElectricSurfaceChargeDensity(double value, UnitSystem unitSystem) /// public static ElectricSurfaceChargeDensity Zero { get; } - #endregion + /// + public static ElectricSurfaceChargeDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index f494a8a7f1..12bc85d96d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The joule, symbol J, is a derived unit of energy, work, or amount of heat in the International System of Units. It is equal to the energy transferred (or work done) when applying a force of one newton through a distance of one metre (1 newton metre or N·m), or in passing an electric current of one ampere through a resistance of one ohm for one second. Many other units of energy are included. Please do not confuse this definition of the calorie with the one colloquially used by the food industry, the large calorie, which is equivalent to 1 kcal. Thermochemical definition of the calorie is used. For BTU, the IT definition is used. /// [DataContract] - public readonly partial struct Energy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Energy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -165,8 +165,11 @@ public Energy(double value, UnitSystem unitSystem) /// public static Energy Zero { get; } - #endregion + /// + public static Energy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs index 8146a11acf..d6fddeeb95 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// /// [DataContract] - public readonly partial struct EnergyDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct EnergyDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public EnergyDensity(double value, UnitSystem unitSystem) /// public static EnergyDensity Zero { get; } - #endregion + /// + public static EnergyDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index 2c3f7a80bd..4d0a45b92b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Entropy is an important concept in the branch of science known as thermodynamics. The idea of "irreversibility" is central to the understanding of entropy. It is often said that entropy is an expression of the disorder, or randomness of a system, or of our lack of information about it. Entropy is an extensive property. It has the dimension of energy divided by temperature, which has a unit of joules per kelvin (J/K) in the International System of Units /// [DataContract] - public readonly partial struct Entropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Entropy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public Entropy(double value, UnitSystem unitSystem) /// public static Entropy Zero { get; } - #endregion + /// + public static Entropy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 4e088bff93..b5d6412ea5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In physics, a force is any influence that causes an object to undergo a certain change, either concerning its movement, direction, or geometrical construction. In other words, a force can cause an object with mass to change its velocity (which includes to begin moving from a state of rest), i.e., to accelerate, or a flexible object to deform, or both. Force can also be described by intuitive concepts such as a push or a pull. A force has both magnitude and direction, making it a vector quantity. It is measured in the SI unit of newtons and represented by the symbol F. /// [DataContract] - public readonly partial struct Force : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Force : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -142,8 +142,11 @@ public Force(double value, UnitSystem unitSystem) /// public static Force Zero { get; } - #endregion + /// + public static Force AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index 716fc21aff..ad41cfec24 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Force change rate is the ratio of the force change to the time during which the change occurred (value of force changes per unit time). /// [DataContract] - public readonly partial struct ForceChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ForceChangeRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -142,8 +142,11 @@ public ForceChangeRate(double value, UnitSystem unitSystem) /// public static ForceChangeRate Zero { get; } - #endregion + /// + public static ForceChangeRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 4f192b5051..c128f3a3a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The magnitude of force per unit length. /// [DataContract] - public readonly partial struct ForcePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ForcePerLength : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -165,8 +165,11 @@ public ForcePerLength(double value, UnitSystem unitSystem) /// public static ForcePerLength Zero { get; } - #endregion + /// + public static ForcePerLength AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index a61381fd26..54cd92d566 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The number of occurrences of a repeating event per unit time. /// [DataContract] - public readonly partial struct Frequency : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Frequency : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -138,8 +138,11 @@ public Frequency(double value, UnitSystem unitSystem) /// public static Frequency Zero { get; } - #endregion + /// + public static Frequency AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs index 8429c8302e..75d1adc22f 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Fuel_efficiency /// [DataContract] - public readonly partial struct FuelEfficiency : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct FuelEfficiency : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public FuelEfficiency(double value, UnitSystem unitSystem) /// public static FuelEfficiency Zero { get; } - #endregion + /// + public static FuelEfficiency AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index 50e7631984..9f99cfbdb8 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Heat flux is the flow of energy per unit of area per unit of time /// [DataContract] - public readonly partial struct HeatFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct HeatFlux : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -145,8 +145,11 @@ public HeatFlux(double value, UnitSystem unitSystem) /// public static HeatFlux Zero { get; } - #endregion + /// + public static HeatFlux AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 5686653de0..9d3d8c4480 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The heat transfer coefficient or film coefficient, or film effectiveness, in thermodynamics and in mechanics is the proportionality constant between the heat flux and the thermodynamic driving force for the flow of heat (i.e., the temperature difference, ΔT) /// [DataContract] - public readonly partial struct HeatTransferCoefficient : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct HeatTransferCoefficient : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public HeatTransferCoefficient(double value, UnitSystem unitSystem) /// public static HeatTransferCoefficient Zero { get; } - #endregion + /// + public static HeatTransferCoefficient AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 9e820a1608..523809d34c 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Illuminance /// [DataContract] - public readonly partial struct Illuminance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Illuminance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public Illuminance(double value, UnitSystem unitSystem) /// public static Illuminance Zero { get; } - #endregion + /// + public static Illuminance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 6150a147e0..39a3cdf603 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In computing and telecommunications, a unit of information is the capacity of some standard data storage system or communication channel, used to measure the capacities of other systems and channels. In information theory, units of information are also used to measure the information contents or entropy of random variables. /// [DataContract] - public readonly partial struct Information : IQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Information : IArithmeticQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -153,8 +153,11 @@ public Information(decimal value, UnitSystem unitSystem) /// public static Information Zero { get; } - #endregion + /// + public static Information AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 5dd24b9b15..a00a5a4540 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Irradiance is the intensity of ultraviolet (UV) or visible light incident on a surface. /// [DataContract] - public readonly partial struct Irradiance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Irradiance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,8 +141,11 @@ public Irradiance(double value, UnitSystem unitSystem) /// public static Irradiance Zero { get; } - #endregion + /// + public static Irradiance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index 406e255b8c..755337d54e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Irradiation /// [DataContract] - public readonly partial struct Irradiation : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Irradiation : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -137,8 +137,11 @@ public Irradiation(double value, UnitSystem unitSystem) /// public static Irradiation Zero { get; } - #endregion + /// + public static Irradiation AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs index 38bcce066a..eab9fe53f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// /// [DataContract] - public readonly partial struct Jerk : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Jerk : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -138,8 +138,11 @@ public Jerk(double value, UnitSystem unitSystem) /// public static Jerk Zero { get; } - #endregion + /// + public static Jerk AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index 08bdc87ebb..583f0f686d 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Viscosity /// [DataContract] - public readonly partial struct KinematicViscosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct KinematicViscosity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public KinematicViscosity(double value, UnitSystem unitSystem) /// public static KinematicViscosity Zero { get; } - #endregion + /// + public static KinematicViscosity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 4d2da67328..4c5c7a0e49 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Many different units of length have been used around the world. The main units in modern use are U.S. customary units in the United States and the Metric system elsewhere. British Imperial units are still used for some purposes in the United Kingdom and some other countries. The metric system is sub-divided into SI and non-SI units. /// [DataContract] - public readonly partial struct Length : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Length : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -163,8 +163,11 @@ public Length(double value, UnitSystem unitSystem) /// public static Length Zero { get; } - #endregion + /// + public static Length AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index a739fef44b..846bc45761 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Level is the logarithm of the ratio of a quantity Q to a reference value of that quantity, Q₀, expressed in dimensionless units. /// [DataContract] - public readonly partial struct Level : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Level : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -129,8 +129,11 @@ public Level(double value, UnitSystem unitSystem) /// public static Level Zero { get; } - #endregion + /// + public static Level AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index f1e2fc2c0a..f15e3c0dc7 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Linear_density /// [DataContract] - public readonly partial struct LinearDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct LinearDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -144,8 +144,11 @@ public LinearDensity(double value, UnitSystem unitSystem) /// public static LinearDensity Zero { get; } - #endregion + /// + public static LinearDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs index 0302512aed..0ced684151 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Linear_density /// [DataContract] - public readonly partial struct LinearPowerDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct LinearPowerDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -155,8 +155,11 @@ public LinearPowerDensity(double value, UnitSystem unitSystem) /// public static LinearPowerDensity Zero { get; } - #endregion + /// + public static LinearPowerDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs index f55754738e..b39f3831c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminance /// [DataContract] - public readonly partial struct Luminance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Luminance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -140,8 +140,11 @@ public Luminance(double value, UnitSystem unitSystem) /// public static Luminance Zero { get; } - #endregion + /// + public static Luminance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs index cb75fcb2a4..ae66d5357b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminosity /// [DataContract] - public readonly partial struct Luminosity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Luminosity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -144,8 +144,11 @@ public Luminosity(double value, UnitSystem unitSystem) /// public static Luminosity Zero { get; } - #endregion + /// + public static Luminosity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index e814dbe5c1..9df0e7c9ae 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminous_flux /// [DataContract] - public readonly partial struct LuminousFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct LuminousFlux : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public LuminousFlux(double value, UnitSystem unitSystem) /// public static LuminousFlux Zero { get; } - #endregion + /// + public static LuminousFlux AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index f37e8d26e6..20b08ec117 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Luminous_intensity /// [DataContract] - public readonly partial struct LuminousIntensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct LuminousIntensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public LuminousIntensity(double value, UnitSystem unitSystem) /// public static LuminousIntensity Zero { get; } - #endregion + /// + public static LuminousIntensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 4adcb63faf..e19c887bbe 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetic_field /// [DataContract] - public readonly partial struct MagneticField : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MagneticField : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -136,8 +136,11 @@ public MagneticField(double value, UnitSystem unitSystem) /// public static MagneticField Zero { get; } - #endregion + /// + public static MagneticField AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 7f4a257ba4..066d1e08d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetic_flux /// [DataContract] - public readonly partial struct MagneticFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MagneticFlux : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public MagneticFlux(double value, UnitSystem unitSystem) /// public static MagneticFlux Zero { get; } - #endregion + /// + public static MagneticFlux AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 0f895ac39a..c81155fc68 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Magnetization /// [DataContract] - public readonly partial struct Magnetization : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Magnetization : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public Magnetization(double value, UnitSystem unitSystem) /// public static Magnetization Zero { get; } - #endregion + /// + public static Magnetization AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index ed0cc7d56c..de6ac8cc93 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In physics, mass (from Greek μᾶζα "barley cake, lump [of dough]") is a property of a physical system or body, giving rise to the phenomena of the body's resistance to being accelerated by a force and the strength of its mutual gravitational attraction with other bodies. Instruments such as mass balances or scales use those phenomena to measure mass. The SI unit of mass is the kilogram (kg). /// [DataContract] - public readonly partial struct Mass : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Mass : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -152,8 +152,11 @@ public Mass(double value, UnitSystem unitSystem) /// public static Mass Zero { get; } - #endregion + /// + public static Mass AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs index 76895865b4..44a6ab7971 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Mass_concentration_(chemistry) /// [DataContract] - public readonly partial struct MassConcentration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MassConcentration : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -179,8 +179,11 @@ public MassConcentration(double value, UnitSystem unitSystem) /// public static MassConcentration Zero { get; } - #endregion + /// + public static MassConcentration AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index 64be7c8138..165e72c773 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Mass flow is the ratio of the mass change to the time during which the change occurred (value of mass changes per unit time). /// [DataContract] - public readonly partial struct MassFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MassFlow : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -160,8 +160,11 @@ public MassFlow(double value, UnitSystem unitSystem) /// public static MassFlow Zero { get; } - #endregion + /// + public static MassFlow AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index 81893c0d81..f86bf3cd4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Mass flux is the mass flow rate per unit area. /// [DataContract] - public readonly partial struct MassFlux : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MassFlux : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public MassFlux(double value, UnitSystem unitSystem) /// public static MassFlux Zero { get; } - #endregion + /// + public static MassFlux AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs index 69c7fefd8c..692b663a59 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Mass_fraction_(chemistry) /// [DataContract] - public readonly partial struct MassFraction : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MassFraction : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -154,8 +154,11 @@ public MassFraction(double value, UnitSystem unitSystem) /// public static MassFraction Zero { get; } - #endregion + /// + public static MassFraction AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index 40c5ce2af2..3c22f92d29 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A property of body reflects how its mass is distributed with regard to an axis. /// [DataContract] - public readonly partial struct MassMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MassMomentOfInertia : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -155,8 +155,11 @@ public MassMomentOfInertia(double value, UnitSystem unitSystem) /// public static MassMomentOfInertia Zero { get; } - #endregion + /// + public static MassMomentOfInertia AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index aa6d7cc4fa..9b4fff4499 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Molar energy is the amount of energy stored in 1 mole of a substance. /// [DataContract] - public readonly partial struct MolarEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MolarEnergy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public MolarEnergy(double value, UnitSystem unitSystem) /// public static MolarEnergy Zero { get; } - #endregion + /// + public static MolarEnergy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index 0f2493fc31..8e8af45d68 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Molar entropy is amount of energy required to increase temperature of 1 mole substance by 1 Kelvin. /// [DataContract] - public readonly partial struct MolarEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MolarEntropy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public MolarEntropy(double value, UnitSystem unitSystem) /// public static MolarEntropy Zero { get; } - #endregion + /// + public static MolarEntropy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index 0943adfc2a..d913a73db4 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In chemistry, the molar mass M is a physical property defined as the mass of a given substance (chemical element or chemical compound) divided by the amount of substance. /// [DataContract] - public readonly partial struct MolarMass : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct MolarMass : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public MolarMass(double value, UnitSystem unitSystem) /// public static MolarMass Zero { get; } - #endregion + /// + public static MolarMass AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index 43ec171988..5244c4abd9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Molar_concentration /// [DataContract] - public readonly partial struct Molarity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Molarity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public Molarity(double value, UnitSystem unitSystem) /// public static Molarity Zero { get; } - #endregion + /// + public static Molarity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index c73e5d3093..616d8732b5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Permeability_(electromagnetism) /// [DataContract] - public readonly partial struct Permeability : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Permeability : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public Permeability(double value, UnitSystem unitSystem) /// public static Permeability Zero { get; } - #endregion + /// + public static Permeability AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 170400b0e6..5bb66d8565 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Permittivity /// [DataContract] - public readonly partial struct Permittivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Permittivity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public Permittivity(double value, UnitSystem unitSystem) /// public static Permittivity Zero { get; } - #endregion + /// + public static Permittivity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs index 06b4be289b..b6b662e970 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Permeability_(Earth_sciences) /// [DataContract] - public readonly partial struct PorousMediumPermeability : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct PorousMediumPermeability : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -135,8 +135,11 @@ public PorousMediumPermeability(double value, UnitSystem unitSystem) /// public static PorousMediumPermeability Zero { get; } - #endregion + /// + public static PorousMediumPermeability AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index a514d7740d..f6dbf7cd16 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In physics, power is the rate of doing work. It is equivalent to an amount of energy consumed per unit time. /// [DataContract] - public readonly partial struct Power : IQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Power : IArithmeticQuantity, IDecimalQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -153,8 +153,11 @@ public Power(decimal value, UnitSystem unitSystem) /// public static Power Zero { get; } - #endregion + /// + public static Power AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 2a2379987b..e2d2a7cea8 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The amount of power in a volume. /// [DataContract] - public readonly partial struct PowerDensity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct PowerDensity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -171,8 +171,11 @@ public PowerDensity(double value, UnitSystem unitSystem) /// public static PowerDensity Zero { get; } - #endregion + /// + public static PowerDensity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 01534186c5..8f186f63cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The strength of a signal expressed in decibels (dB) relative to one watt. /// [DataContract] - public readonly partial struct PowerRatio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct PowerRatio : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -129,8 +129,11 @@ public PowerRatio(double value, UnitSystem unitSystem) /// public static PowerRatio Zero { get; } - #endregion + /// + public static PowerRatio AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 296a10bec7..54411b8a29 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Pressure (symbol: P or p) is the ratio of force to the area over which that force is distributed. Pressure is force per unit area applied in a direction perpendicular to the surface of an object. Gauge pressure (also spelled gage pressure)[a] is the pressure relative to the local atmospheric or ambient pressure. Pressure is measured in any unit of force divided by any unit of area. The SI unit of pressure is the newton per square metre, which is called the pascal (Pa) after the seventeenth-century philosopher and scientist Blaise Pascal. A pressure of 1 Pa is small; it approximately equals the pressure exerted by a dollar bill resting flat on a table. Everyday pressures are often stated in kilopascals (1 kPa = 1000 Pa). /// [DataContract] - public readonly partial struct Pressure : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Pressure : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -174,8 +174,11 @@ public Pressure(double value, UnitSystem unitSystem) /// public static Pressure Zero { get; } - #endregion + /// + public static Pressure AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index dacfac6ffe..aaba7fa985 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Pressure change rate is the ratio of the pressure change to the time during which the change occurred (value of pressure changes per unit time). /// [DataContract] - public readonly partial struct PressureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct PressureChangeRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,8 +141,11 @@ public PressureChangeRate(double value, UnitSystem unitSystem) /// public static PressureChangeRate Zero { get; } - #endregion + /// + public static PressureChangeRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index bd86461606..ac1ac8ea12 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In mathematics, a ratio is a relationship between two numbers of the same kind (e.g., objects, persons, students, spoonfuls, units of whatever identical dimension), usually expressed as "a to b" or a:b, sometimes expressed arithmetically as a dimensionless quotient of the two that explicitly indicates how many times the first number contains the second (not necessarily an integer). /// [DataContract] - public readonly partial struct Ratio : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Ratio : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public Ratio(double value, UnitSystem unitSystem) /// public static Ratio Zero { get; } - #endregion + /// + public static Ratio AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs index 823ec56232..336b7f5e8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The change in ratio per unit of time. /// [DataContract] - public readonly partial struct RatioChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RatioChangeRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -129,8 +129,11 @@ public RatioChangeRate(double value, UnitSystem unitSystem) /// public static RatioChangeRate Zero { get; } - #endregion + /// + public static RatioChangeRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index eeb257cafc..5657a371a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The Volt-ampere reactive hour (expressed as varh) is the reactive power of one Volt-ampere reactive produced in one hour. /// [DataContract] - public readonly partial struct ReactiveEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ReactiveEnergy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public ReactiveEnergy(double value, UnitSystem unitSystem) /// public static ReactiveEnergy Zero { get; } - #endregion + /// + public static ReactiveEnergy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index ed55b8f831..af253aff02 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Volt-ampere reactive (var) is a unit by which reactive power is expressed in an AC electric power system. Reactive power exists in an AC circuit when the current and voltage are not in phase. /// [DataContract] - public readonly partial struct ReactivePower : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ReactivePower : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public ReactivePower(double value, UnitSystem unitSystem) /// public static ReactivePower Zero { get; } - #endregion + /// + public static ReactivePower AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs index 271b01ba1c..53b5dc4462 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Inverse-square_law /// [DataContract] - public readonly partial struct ReciprocalArea : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ReciprocalArea : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -141,8 +141,11 @@ public ReciprocalArea(double value, UnitSystem unitSystem) /// public static ReciprocalArea Zero { get; } - #endregion + /// + public static ReciprocalArea AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs index 94c0499e00..37f0e3bd9e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Reciprocal_length /// [DataContract] - public readonly partial struct ReciprocalLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ReciprocalLength : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -140,8 +140,11 @@ public ReciprocalLength(double value, UnitSystem unitSystem) /// public static ReciprocalLength Zero { get; } - #endregion + /// + public static ReciprocalLength AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs index 445f65c7a0..ce1899c085 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Relative humidity is a ratio of the actual water vapor present in the air to the maximum water vapor in the air at the given temperature. /// [DataContract] - public readonly partial struct RelativeHumidity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RelativeHumidity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -128,8 +128,11 @@ public RelativeHumidity(double value, UnitSystem unitSystem) /// public static RelativeHumidity Zero { get; } - #endregion + /// + public static RelativeHumidity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 229caa126f..71174e3415 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Angular acceleration is the rate of change of rotational speed. /// [DataContract] - public readonly partial struct RotationalAcceleration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RotationalAcceleration : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public RotationalAcceleration(double value, UnitSystem unitSystem) /// public static RotationalAcceleration Zero { get; } - #endregion + /// + public static RotationalAcceleration AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 946d5c8a42..57b4e06716 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Rotational speed (sometimes called speed of revolution) is the number of complete rotations, revolutions, cycles, or turns per time unit. Rotational speed is a cyclic frequency, measured in radians per second or in hertz in the SI System by scientists, or in revolutions per minute (rpm or min-1) or revolutions per second in everyday life. The symbol for rotational speed is ω (the Greek lowercase letter "omega"). /// [DataContract] - public readonly partial struct RotationalSpeed : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RotationalSpeed : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -140,8 +140,11 @@ public RotationalSpeed(double value, UnitSystem unitSystem) /// public static RotationalSpeed Zero { get; } - #endregion + /// + public static RotationalSpeed AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 0af5755918..8ee0f934a1 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// [DataContract] - public readonly partial struct RotationalStiffness : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RotationalStiffness : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -160,8 +160,11 @@ public RotationalStiffness(double value, UnitSystem unitSystem) /// public static RotationalStiffness Zero { get; } - #endregion + /// + public static RotationalStiffness AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index ffa027ea3f..6fc4666df4 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Stiffness#Rotational_stiffness /// [DataContract] - public readonly partial struct RotationalStiffnessPerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct RotationalStiffnessPerLength : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,8 +132,11 @@ public RotationalStiffnessPerLength(double value, UnitSystem unitSystem) /// public static RotationalStiffnessPerLength Zero { get; } - #endregion + /// + public static RotationalStiffnessPerLength AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs index 349c9952d2..8b69e08206 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A way of representing a number of items. /// [DataContract] - public readonly partial struct Scalar : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Scalar : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -128,8 +128,11 @@ public Scalar(double value, UnitSystem unitSystem) /// public static Scalar Zero { get; } - #endregion + /// + public static Scalar AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index 2ce115befc..ca62ba4ad7 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Solid_angle /// [DataContract] - public readonly partial struct SolidAngle : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SolidAngle : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public SolidAngle(double value, UnitSystem unitSystem) /// public static SolidAngle Zero { get; } - #endregion + /// + public static SolidAngle AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 9f1b691194..dab35a073e 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Specific_energy /// [DataContract] - public readonly partial struct SpecificEnergy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SpecificEnergy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -159,8 +159,11 @@ public SpecificEnergy(double value, UnitSystem unitSystem) /// public static SpecificEnergy Zero { get; } - #endregion + /// + public static SpecificEnergy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 3f88dbc073..2a437caa79 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Specific entropy is an amount of energy required to raise temperature of a substance by 1 Kelvin per unit mass. /// [DataContract] - public readonly partial struct SpecificEntropy : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SpecificEntropy : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -136,8 +136,11 @@ public SpecificEntropy(double value, UnitSystem unitSystem) /// public static SpecificEntropy Zero { get; } - #endregion + /// + public static SpecificEntropy AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs index d07b4d3e6a..6af1748861 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Thrust-specific_fuel_consumption /// [DataContract] - public readonly partial struct SpecificFuelConsumption : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SpecificFuelConsumption : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public SpecificFuelConsumption(double value, UnitSystem unitSystem) /// public static SpecificFuelConsumption Zero { get; } - #endregion + /// + public static SpecificFuelConsumption AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 207b1dd134..fc30c9f17b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In thermodynamics, the specific volume of a substance is the ratio of the substance's volume to its mass. It is the reciprocal of density and an intrinsic property of matter as well. /// [DataContract] - public readonly partial struct SpecificVolume : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SpecificVolume : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -130,8 +130,11 @@ public SpecificVolume(double value, UnitSystem unitSystem) /// public static SpecificVolume Zero { get; } - #endregion + /// + public static SpecificVolume AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index e1055b5b03..b799174065 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// http://en.wikipedia.org/wiki/Specificweight /// [DataContract] - public readonly partial struct SpecificWeight : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct SpecificWeight : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -147,8 +147,11 @@ public SpecificWeight(double value, UnitSystem unitSystem) /// public static SpecificWeight Zero { get; } - #endregion + /// + public static SpecificWeight AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 9c379a903b..849bb89906 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In everyday use and in kinematics, the speed of an object is the magnitude of its velocity (the rate of change of its position); it is thus a scalar quantity.[1] The average speed of an object in an interval of time is the distance travelled by the object divided by the duration of the interval;[2] the instantaneous speed is the limit of the average speed as the duration of the time interval approaches zero. /// [DataContract] - public readonly partial struct Speed : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Speed : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -160,8 +160,11 @@ public Speed(double value, UnitSystem unitSystem) /// public static Speed Zero { get; } - #endregion + /// + public static Speed AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs index 7c08150d81..8c959aba7e 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The molar flow rate of a gas corrected to standardized conditions of temperature and pressure thus representing a fixed number of moles of gas regardless of composition and actual flow conditions. /// [DataContract] - public readonly partial struct StandardVolumeFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct StandardVolumeFlow : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -136,8 +136,11 @@ public StandardVolumeFlow(double value, UnitSystem unitSystem) /// public static StandardVolumeFlow Zero { get; } - #endregion + /// + public static StandardVolumeFlow AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index 64a4a4a6da..7b5ee2cff0 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A temperature is a numerical measure of hot or cold. Its measurement is by detection of heat radiation or particle velocity or kinetic energy, or by the bulk behavior of a thermometric material. It may be calibrated in any of various temperature scales, Celsius, Fahrenheit, Kelvin, etc. The fundamental physical definition of temperature is provided by thermodynamics. /// [DataContract] - public readonly partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -138,7 +138,7 @@ public Temperature(double value, UnitSystem unitSystem) public static Temperature Zero { get; } #endregion - + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index 467b06820e..24ada2aa55 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Temperature change rate is the ratio of the temperature change to the time during which the change occurred (value of temperature changes per unit time). /// [DataContract] - public readonly partial struct TemperatureChangeRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct TemperatureChangeRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -137,8 +137,11 @@ public TemperatureChangeRate(double value, UnitSystem unitSystem) /// public static TemperatureChangeRate Zero { get; } - #endregion + /// + public static TemperatureChangeRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index ab4620892c..a9a16c623c 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Difference between two temperatures. The conversions are different than for Temperature. /// [DataContract] - public readonly partial struct TemperatureDelta : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct TemperatureDelta : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -136,8 +136,11 @@ public TemperatureDelta(double value, UnitSystem unitSystem) /// public static TemperatureDelta Zero { get; } - #endregion + /// + public static TemperatureDelta AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs index 97dab6c719..e5b0bc8fae 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// /// [DataContract] - public readonly partial struct TemperatureGradient : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct TemperatureGradient : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public TemperatureGradient(double value, UnitSystem unitSystem) /// public static TemperatureGradient Zero { get; } - #endregion + /// + public static TemperatureGradient AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 088093dc4c..7b86af441d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Thermal_Conductivity /// [DataContract] - public readonly partial struct ThermalConductivity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ThermalConductivity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -132,8 +132,11 @@ public ThermalConductivity(double value, UnitSystem unitSystem) /// public static ThermalConductivity Zero { get; } - #endregion + /// + public static ThermalConductivity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index e5d9980ca6..376a155418 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Heat Transfer Coefficient or Thermal conductivity - indicates a materials ability to conduct heat. /// [DataContract] - public readonly partial struct ThermalResistance : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct ThermalResistance : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public ThermalResistance(double value, UnitSystem unitSystem) /// public static ThermalResistance Zero { get; } - #endregion + /// + public static ThermalResistance AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 4c3c469fb2..a147e43adc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Torque, moment or moment of force (see the terminology below), is the tendency of a force to rotate an object about an axis,[1] fulcrum, or pivot. Just as a force is a push or a pull, a torque can be thought of as a twist to an object. Mathematically, torque is defined as the cross product of the lever-arm distance and force, which tends to produce rotation. Loosely speaking, torque is a measure of the turning force on an object such as a bolt or a flywheel. For example, pushing or pulling the handle of a wrench connected to a nut or bolt produces a torque (turning force) that loosens or tightens the nut or bolt. /// [DataContract] - public readonly partial struct Torque : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Torque : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -152,8 +152,11 @@ public Torque(double value, UnitSystem unitSystem) /// public static Torque Zero { get; } - #endregion + /// + public static Torque AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs index bc6cc4b4e9..8368c55b96 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// The magnitude of torque per unit length. /// [DataContract] - public readonly partial struct TorquePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct TorquePerLength : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -148,8 +148,11 @@ public TorquePerLength(double value, UnitSystem unitSystem) /// public static TorquePerLength Zero { get; } - #endregion + /// + public static TorquePerLength AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs index 886123b7a3..52990e4c03 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Turbidity /// [DataContract] - public readonly partial struct Turbidity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Turbidity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -131,8 +131,11 @@ public Turbidity(double value, UnitSystem unitSystem) /// public static Turbidity Zero { get; } - #endregion + /// + public static Turbidity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 28b41203b7..87629b7519 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Vitamin A: 1 IU is the biological equivalent of 0.3 µg retinol, or of 0.6 µg beta-carotene. /// [DataContract] - public readonly partial struct VitaminA : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VitaminA : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -128,8 +128,11 @@ public VitaminA(double value, UnitSystem unitSystem) /// public static VitaminA Zero { get; } - #endregion + /// + public static VitaminA AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index f13e583707..ebecd9d997 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Volume is the quantity of three-dimensional space enclosed by some closed boundary, for example, the space that a substance (solid, liquid, gas, or plasma) or shape occupies or contains.[1] Volume is often quantified numerically using the SI derived unit, the cubic metre. The volume of a container is generally understood to be the capacity of the container, i. e. the amount of fluid (gas or liquid) that the container could hold, rather than the amount of space the container itself displaces. /// [DataContract] - public readonly partial struct Volume : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Volume : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -180,8 +180,11 @@ public Volume(double value, UnitSystem unitSystem) /// public static Volume Zero { get; } - #endregion + /// + public static Volume AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs index 0f19a52ce8..e37c38c961 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Concentration#Volume_concentration /// [DataContract] - public readonly partial struct VolumeConcentration : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VolumeConcentration : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -150,8 +150,11 @@ public VolumeConcentration(double value, UnitSystem unitSystem) /// public static VolumeConcentration Zero { get; } - #endregion + /// + public static VolumeConcentration AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 3f6808da24..7fe1f66710 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// In physics and engineering, in particular fluid dynamics and hydrometry, the volumetric flow rate, (also known as volume flow rate, rate of fluid flow or volume velocity) is the volume of fluid which passes through a given surface per unit time. The SI unit is m³/s (cubic meters per second). In US Customary Units and British Imperial Units, volumetric flow rate is often expressed as ft³/s (cubic feet per second). It is usually represented by the symbol Q. /// [DataContract] - public readonly partial struct VolumeFlow : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VolumeFlow : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -189,8 +189,11 @@ public VolumeFlow(double value, UnitSystem unitSystem) /// public static VolumeFlow Zero { get; } - #endregion + /// + public static VolumeFlow AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs index 2f016e210d..15ebfb4113 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// /// [DataContract] - public readonly partial struct VolumeFlowPerArea : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VolumeFlowPerArea : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -129,8 +129,11 @@ public VolumeFlowPerArea(double value, UnitSystem unitSystem) /// public static VolumeFlowPerArea Zero { get; } - #endregion + /// + public static VolumeFlowPerArea AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs index c368e59a11..79fb39776b 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// Volume, typically of fluid, that a container can hold within a unit of length. /// [DataContract] - public readonly partial struct VolumePerLength : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VolumePerLength : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -134,8 +134,11 @@ public VolumePerLength(double value, UnitSystem unitSystem) /// public static VolumePerLength Zero { get; } - #endregion + /// + public static VolumePerLength AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs index 995dc55fa6..e2b8beeec4 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -39,7 +39,7 @@ namespace UnitsNet /// https://en.wikipedia.org/wiki/Volumetric_heat_capacity /// [DataContract] - public readonly partial struct VolumetricHeatCapacity : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct VolumetricHeatCapacity : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -139,8 +139,11 @@ public VolumetricHeatCapacity(double value, UnitSystem unitSystem) /// public static VolumetricHeatCapacity Zero { get; } - #endregion + /// + public static VolumetricHeatCapacity AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs index 4dc8aee8b8..f57ed756cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// A geometric property of an area that is used to determine the warping stress. /// [DataContract] - public readonly partial struct WarpingMomentOfInertia : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct WarpingMomentOfInertia : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -133,8 +133,11 @@ public WarpingMomentOfInertia(double value, UnitSystem unitSystem) /// public static WarpingMomentOfInertia Zero { get; } - #endregion + /// + public static WarpingMomentOfInertia AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GenericMath/DecimalGenericMathExtensions.cs b/UnitsNet/GenericMath/DecimalGenericMathExtensions.cs new file mode 100644 index 0000000000..2c686c9d90 --- /dev/null +++ b/UnitsNet/GenericMath/DecimalGenericMathExtensions.cs @@ -0,0 +1,50 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +#if NET7_0_OR_GREATER + +using System.Collections.Generic; +using System.Linq; +using System.Numerics; + +namespace UnitsNet.GenericMath; + +/// +/// Provides generic math operations to test out the new generic math interfaces implemented in .NET7 for UnitsNet +/// quantities using as the internal value type, such as , and +/// . +/// +/// +/// See for quantities using as the internal value type. +/// +public static class DecimalGenericMathExtensions +{ + /// + /// Returns the average of values. + /// + /// + /// This method is experimental and intended to test out the new generic math interfaces implemented in .NET7 for + /// UnitsNet quantities.
+ /// Generic math interfaces might replace .
+ /// Generic math LINQ support is still missing in the BCL, but is being worked on: + /// + /// API Proposal: Generic LINQ Numeric Operators · Issue + /// #64031 · dotnet/runtime + /// + ///
+ /// The values. + /// The value type. + /// The average. + public static T Average(this IEnumerable source) + where T : IAdditionOperators, IAdditiveIdentity, IDivisionOperators + { + // Put accumulator on right hand side of the addition operator to construct quantities with the same unit as the values. + // The addition operator implementation picks the unit from the left hand side, and the additive identity (e.g. Length.Zero) is always the base unit. + (T value, int count) result = source.Aggregate( + (value: T.AdditiveIdentity, count: 0), + (acc, item) => (value: item + acc.value, count: acc.count + 1)); + + return result.value / result.count; + } +} +#endif diff --git a/UnitsNet/GenericMath/GenericMathExtensions.cs b/UnitsNet/GenericMath/GenericMathExtensions.cs new file mode 100644 index 0000000000..c9b46844ce --- /dev/null +++ b/UnitsNet/GenericMath/GenericMathExtensions.cs @@ -0,0 +1,72 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +#if NET7_0_OR_GREATER +using System.Collections.Generic; +using System.Linq; +using System.Numerics; + +namespace UnitsNet.GenericMath; + +/// +/// Provides generic math operations to test out the new generic math interfaces implemented in .NET7 for UnitsNet +/// quantities using as the internal value type, which is the majority of quantities. +/// +/// +/// See for quantities using as the internal value +/// type. +/// +public static class GenericMathExtensions +{ + /// + /// Returns the sum of values. + /// + /// + /// This method is experimental and intended to test out the new generic math interfaces implemented in .NET7 for + /// UnitsNet quantities.
+ /// Generic math interfaces might replace .
+ /// Generic math LINQ support is still missing in the BCL, but is being worked on: + /// + /// API Proposal: Generic LINQ Numeric Operators · Issue #64031 · dotnet/runtime + /// + ///
+ /// The values. + /// The type of value. + /// The sum. + public static T Sum(this IEnumerable source) + where T : IAdditionOperators, IAdditiveIdentity + { + // Put accumulator on right hand side of the addition operator to construct quantities with the same unit as the values. + // The addition operator implementation picks the unit from the left hand side, and the additive identity (e.g. Length.Zero) is always the base unit. + return source.Aggregate(T.AdditiveIdentity, (acc, item) => item + acc); + } + + /// + /// Returns the average of values. + /// + /// + /// This method is experimental and intended to test out the new generic math interfaces implemented in .NET7 for + /// UnitsNet quantities.
+ /// Generic math interfaces might replace .
+ /// Generic math LINQ support is still missing in the BCL, but is being worked on: + /// + /// API Proposal: Generic LINQ Numeric Operators · Issue + /// #64031 · dotnet/runtime + /// + ///
+ /// The values. + /// The value type. + /// The average. + public static T Average(this IEnumerable source) + where T : IAdditionOperators, IAdditiveIdentity, IDivisionOperators + { + // Put accumulator on right hand side of the addition operator to construct quantities with the same unit as the values. + // The addition operator implementation picks the unit from the left hand side, and the additive identity (e.g. Length.Zero) is always the base unit. + (T value, int count) result = source.Aggregate( + (value: T.AdditiveIdentity, count: 0), + (acc, item) => (value: item + acc.value, count: acc.count + 1)); + + return result.value / result.count; + } +} +#endif diff --git a/UnitsNet/IArithmeticQuantity.cs b/UnitsNet/IArithmeticQuantity.cs new file mode 100644 index 0000000000..7e9ce19b06 --- /dev/null +++ b/UnitsNet/IArithmeticQuantity.cs @@ -0,0 +1,37 @@ +// Licensed under MIT No Attribution, see LICENSE file at the root. +// Copyright 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com). Maintained at https://github.com/angularsen/UnitsNet. + +using System; +using System.Numerics; + +namespace UnitsNet; + +/// +/// An that (in .NET 7+) implements generic math interfaces for arithmetic operations. +/// +/// The type itself, for the CRT pattern. +/// The underlying unit enum type. +/// The underlying value type for internal representation. +public interface IArithmeticQuantity : IQuantity +#if NET7_0_OR_GREATER + , IAdditionOperators + , IAdditiveIdentity + , ISubtractionOperators + , IMultiplyOperators + , IDivisionOperators + , IUnaryNegationOperators +#endif + where TSelf : IArithmeticQuantity + where TUnitType : Enum + where TValueType : struct +#if NET7_0_OR_GREATER + , INumber +#endif +{ +#if NET7_0_OR_GREATER + /// + /// The zero value of this quantity. + /// + static abstract TSelf Zero { get; } +#endif +} diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 92d974c5bc..1ea0530d90 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -3,6 +3,9 @@ using System; using System.Globalization; +#if NET7_0_OR_GREATER +using System.Numerics; +#endif using UnitsNet.Units; namespace UnitsNet @@ -113,4 +116,21 @@ public interface IQuantity : IQuantity where TUnitType : Enum /// A new quantity with the determined unit. new IQuantity ToUnit(UnitSystem unitSystem); } + + /// + /// An that (in .NET 7+) implements generic math interfaces for equality, comparison and parsing. + /// + /// The type itself, for the CRT pattern. + /// The underlying unit enum type. + /// The underlying value type for internal representation. + public interface IQuantity : IQuantity +#if NET7_0_OR_GREATER + , IComparisonOperators + , IParsable +#endif + where TSelf : IQuantity + where TUnitType : Enum + where TValueType : struct + { + } } diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index d5e51ce1a2..c731aca179 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -24,7 +24,7 @@ latest enable UnitsNet - netstandard2.0 + netstandard2.0;net7.0