From 9f84b8360486570c37728beb1bde7871a8d54718 Mon Sep 17 00:00:00 2001 From: Andreas Leeb Date: Thu, 8 Dec 2022 19:23:44 +0100 Subject: [PATCH 1/8] Arithmetic, equality and comparison interfaces for generated operators. Build also .NET 7. Ignore nullability warnings for now --- .../UnitsNetGen/QuantityGenerator.cs | 14 ++++++- UnitsNet/IQuantity.cs | 39 +++++++++++++++++++ UnitsNet/UnitsNet.csproj | 20 +++++++++- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index 3b49f16a35..c289a3a199 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -71,7 +71,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" : "IComparableQuantity")}<{_quantity.Name}, {_unitEnumName}, {_quantity.ValueType}>, "); if (_quantity.ValueType == "decimal") { Writer.W("IDecimalQuantity, "); @@ -246,9 +246,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/IQuantity.cs b/UnitsNet/IQuantity.cs index 92d974c5bc..445f90cd2b 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Numerics; using UnitsNet.Units; namespace UnitsNet @@ -113,4 +114,42 @@ 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 and comparison. + /// + /// The type itself, for the CRT pattern. + /// The underlying unit enum type. + /// The underlying value type for internal representation. + public interface IComparableQuantity : IQuantity +#if NET7_0_OR_GREATER + , IEqualityOperators + , IComparisonOperators +#endif + where TSelf : IComparableQuantity + where TUnitType : Enum + where TValueType : struct + { + } + + /// + /// 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 : IComparableQuantity +#if NET7_0_OR_GREATER + , IAdditionOperators + , IAdditiveIdentity + , ISubtractionOperators + , IMultiplyOperators + , IDivisionOperators + , IUnaryNegationOperators +#endif + where TSelf : IArithmeticQuantity + where TUnitType : Enum + where TValueType : struct + { + } } diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index b8328d3469..4c238e1bd2 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -22,9 +22,9 @@ 5.0.0.0 latest - enable + disable UnitsNet - netstandard2.0 + netstandard2.0;net7.0 @@ -41,6 +41,22 @@ true UnitsNet + + 1701;1702 + 612,618,CS8769,CS8632,CS8765,CS8767 + + + 1701;1702 + 612,618,CS8769,CS8632,CS8765,CS8767 + + + 1701;1702 + 612,618,CS8769,CS8632,CS8765,CS8767 + + + 1701;1702 + 612,618,CS8769,CS8632,CS8765,CS8767 + From 96bd42d34a2a33247dd55e173296593ff006cb44 Mon Sep 17 00:00:00 2001 From: Andreas Leeb Date: Thu, 8 Dec 2022 19:25:52 +0100 Subject: [PATCH 2/8] Codegen --- UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Angle.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Area.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/BitRate.g.cs | 7 +++++-- .../Quantities/BrakeSpecificFuelConsumption.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs | 7 +++++-- .../Quantities/CoefficientOfThermalExpansion.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Density.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Duration.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs | 7 +++++-- .../GeneratedCode/Quantities/ElectricChargeDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs | 7 +++++-- .../GeneratedCode/Quantities/ElectricConductivity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs | 7 +++++-- .../GeneratedCode/Quantities/ElectricCurrentDensity.g.cs | 7 +++++-- .../GeneratedCode/Quantities/ElectricCurrentGradient.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs | 7 +++++-- .../Quantities/ElectricPotentialChangeRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs | 7 +++++-- .../Quantities/ElectricSurfaceChargeDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Energy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Entropy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Force.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Frequency.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs | 7 +++++-- .../GeneratedCode/Quantities/HeatTransferCoefficient.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Information.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Jerk.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Length.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Level.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Luminance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Mass.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Molarity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Permeability.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs | 7 +++++-- .../GeneratedCode/Quantities/PorousMediumPermeability.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Power.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Pressure.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Ratio.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs | 7 +++++-- .../GeneratedCode/Quantities/RotationalAcceleration.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs | 7 +++++-- .../Quantities/RotationalStiffnessPerLength.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Scalar.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs | 7 +++++-- .../GeneratedCode/Quantities/SpecificFuelConsumption.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Speed.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Temperature.g.cs | 4 ++-- .../GeneratedCode/Quantities/TemperatureChangeRate.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Torque.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/Volume.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs | 7 +++++-- UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs | 7 +++++-- .../GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs | 7 +++++-- .../GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs | 7 +++++-- 117 files changed, 582 insertions(+), 234 deletions(-) diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index 6f46045043..1f3d7ecfe3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -35,7 +35,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. @@ -140,8 +140,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 872a8d9f7b..d58e7cc2f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -35,7 +35,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. @@ -141,8 +141,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 921ee0f215..537869b26c 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 8ae2c7efc3..ed973876c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -35,7 +35,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. @@ -142,8 +142,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 bb8384a01c..3df15a321e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 0699cf9e05..d533e3335c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 7abecbe02b..f890bb96da 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -35,7 +35,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. @@ -140,8 +140,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 e18754d2f1..0fcf3b000e 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 3ed484bee5..7a48634bc5 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -35,7 +35,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. @@ -132,8 +132,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 dcb500d79d..ecb5f29772 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -38,7 +38,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. @@ -155,8 +155,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 a27f3ac938..fe54354689 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 c835cd11af..d5e4bc1f90 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -38,7 +38,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. @@ -136,8 +136,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 b74d70e9bb..9eb0926c9b 100644 --- a/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/CoefficientOfThermalExpansion.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 7b36103334..58a479f9f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs @@ -35,7 +35,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. @@ -133,8 +133,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 4173fdfbf9..e29707b4ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -38,7 +38,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. @@ -180,8 +180,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 6a9c10da47..eb70813b77 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -35,7 +35,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. @@ -137,8 +137,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 a85cde6033..3aca757013 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -38,7 +38,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. @@ -139,8 +139,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 3b95388c54..03d2a2eaa7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 43ab7dfe29..11661e948b 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -38,7 +38,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. @@ -134,8 +134,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 e005500e9d..c690c22c98 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 d58c0a5081..b573ebbd4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -38,7 +38,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. @@ -132,8 +132,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 4acf19915d..f11d9fc214 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -38,7 +38,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. @@ -135,8 +135,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 95ec5eab83..4fcdfa0ada 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -35,7 +35,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. @@ -134,8 +134,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 a4aeb7d9e9..4c5fdbaf63 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -38,7 +38,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. @@ -132,8 +132,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 75f0a4b101..d954d0db41 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 b17fc5a194..66592fe8b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 00492301b1..a0485dc28f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -38,7 +38,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. @@ -133,8 +133,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 448cb4d46a..1c5929db93 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -35,7 +35,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. @@ -131,8 +131,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 fe6c3b384b..19d403b0e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -35,7 +35,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. @@ -131,8 +131,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 08f359e742..0ca29977f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialChangeRate.g.cs @@ -35,7 +35,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. @@ -146,8 +146,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 ac3ec904c3..24ee27e72f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -35,7 +35,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. @@ -131,8 +131,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 3b797e76a6..420921c2b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -35,7 +35,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. @@ -132,8 +132,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 09e09fe932..835f65137e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -38,7 +38,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. @@ -143,8 +143,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 9237afd6ec..5ca2904269 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricSurfaceChargeDensity.g.cs @@ -38,7 +38,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. @@ -132,8 +132,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 4dc79514d1..b58b16b01a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -35,7 +35,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. @@ -164,8 +164,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 ff4e567ac2..216dafd21f 100644 --- a/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/EnergyDensity.g.cs @@ -35,7 +35,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. @@ -138,8 +138,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 009703b3a0..273457cf79 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -35,7 +35,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. @@ -133,8 +133,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 fcd7f31a1b..fb604707cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -35,7 +35,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. @@ -141,8 +141,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 b6837c60a1..1244fdf250 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -35,7 +35,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. @@ -141,8 +141,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 2d82206ae2..a15e0fab3c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -35,7 +35,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. @@ -164,8 +164,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 420e826ad3..401eeccde2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -35,7 +35,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. @@ -137,8 +137,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 5b43b6a8d1..9d89a8f379 100644 --- a/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/FuelEfficiency.g.cs @@ -38,7 +38,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. @@ -133,8 +133,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 23d40b13cc..d7a7187240 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -35,7 +35,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. @@ -144,8 +144,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 4bee4ba156..b5bd6c5ff1 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 ecfbc7016d..2c3074d355 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -38,7 +38,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. @@ -133,8 +133,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 5c2b9f0bdb..9704096d67 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -35,7 +35,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. @@ -152,8 +152,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 6733f605f6..e159b7f5e7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -35,7 +35,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. @@ -140,8 +140,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 f9d35c1a87..43882ad34a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -38,7 +38,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. @@ -136,8 +136,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 6ebedf07a9..cb2c26ec59 100644 --- a/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Jerk.g.cs @@ -35,7 +35,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. @@ -137,8 +137,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 619181a743..0dd61034d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -38,7 +38,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. @@ -138,8 +138,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/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index dc5dfe2d11..abb38a120b 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -36,7 +36,7 @@ namespace UnitsNet /// [Obsolete("Use TemperatureGradient instead.")] [DataContract] - public readonly partial struct LapseRate : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct LapseRate : IArithmeticQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -128,8 +128,11 @@ public LapseRate(double value, UnitSystem unitSystem) /// public static LapseRate Zero { get; } - #endregion + /// + public static LapseRate AdditiveIdentity => Zero; + #endregion + #region Properties /// diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index 5f4572beaa..e39ae4a95a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -35,7 +35,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. @@ -162,8 +162,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 147038eaf9..907ecd5cc4 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -35,7 +35,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. @@ -128,8 +128,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 c3cb92b908..58eb129b18 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -38,7 +38,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. @@ -143,8 +143,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 3281c6b995..ea87686803 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearPowerDensity.g.cs @@ -38,7 +38,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. @@ -154,8 +154,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 4ff280d962..269855f301 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminance.g.cs @@ -38,7 +38,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. @@ -139,8 +139,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 db7c207aa5..e87810c3d5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Luminosity.g.cs @@ -38,7 +38,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. @@ -143,8 +143,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 d42e0d53f5..59c161ffe7 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 54c0f2c8b5..b09053ddea 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 62bbdfe827..8f18ff4dc7 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -38,7 +38,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. @@ -135,8 +135,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 25e9887863..ef8313b35c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 96f41fafe3..83f04fd802 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 cb9616986d..02b9038d30 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -35,7 +35,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. @@ -151,8 +151,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 d9b852899b..5c7a390e88 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassConcentration.g.cs @@ -38,7 +38,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. @@ -178,8 +178,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 069f8e0938..1bc2a1135c 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -35,7 +35,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. @@ -159,8 +159,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 7e680ee911..b00060a976 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -35,7 +35,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. @@ -138,8 +138,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 6132ce4b9e..220ee47d70 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFraction.g.cs @@ -38,7 +38,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. @@ -153,8 +153,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 af4c4fe002..4a738c2e26 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -35,7 +35,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. @@ -154,8 +154,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 cc2cadc7de..faae07c21f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 b195f40aed..b1ad78cd2e 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 b3929046a1..7125d74cb1 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -35,7 +35,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. @@ -138,8 +138,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 204fd07f1f..4686a5c293 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -38,7 +38,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. @@ -146,8 +146,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 4349b772a9..2a1c291d4b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 4704d8a91d..99c46a43d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 8c2ba5a2d6..3350f96172 100644 --- a/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PorousMediumPermeability.g.cs @@ -38,7 +38,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. @@ -134,8 +134,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 6c2a900761..1626c145af 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -35,7 +35,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. @@ -152,8 +152,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 35becfd899..3741060d4a 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -35,7 +35,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. @@ -170,8 +170,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 bae5d5e9b3..776d185b09 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -35,7 +35,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. @@ -128,8 +128,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 878bd296e6..1cdb0be5cb 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -35,7 +35,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. @@ -173,8 +173,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 e9c92a19db..17232ae162 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -35,7 +35,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. @@ -140,8 +140,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 5a12dc4fd9..4c247fc3d7 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -35,7 +35,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. @@ -132,8 +132,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 ddffc1cf3d..90b437bdc7 100644 --- a/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RatioChangeRate.g.cs @@ -35,7 +35,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. @@ -128,8 +128,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 6c26f6d502..cf6a0772ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 c0d1b5cc71..79415c7f0c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 12fe121d52..a3193c5644 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalArea.g.cs @@ -38,7 +38,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. @@ -140,8 +140,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 13096334be..f30454ac27 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReciprocalLength.g.cs @@ -38,7 +38,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. @@ -139,8 +139,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 90a3a06769..e9a98d1393 100644 --- a/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RelativeHumidity.g.cs @@ -35,7 +35,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. @@ -127,8 +127,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 5a62a4896b..ce2a07a175 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 cba7ab82ba..c4502c04b9 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -35,7 +35,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. @@ -139,8 +139,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 55c31efb3b..3f9f691c35 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -35,7 +35,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. @@ -159,8 +159,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 3271a39e7f..7161f2b84e 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -35,7 +35,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. @@ -131,8 +131,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 3f68ad2192..7e3c126ede 100644 --- a/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Scalar.g.cs @@ -35,7 +35,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. @@ -127,8 +127,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 7f79e74d36..640f1add6b 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 b4490ff456..e58502ad82 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -38,7 +38,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. @@ -158,8 +158,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 8ee4ec4878..8f14c10f72 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -35,7 +35,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. @@ -135,8 +135,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 a09c0cb448..e6b7e164cc 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificFuelConsumption.g.cs @@ -38,7 +38,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. @@ -133,8 +133,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 a26a6f0053..99b93752f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -35,7 +35,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. @@ -129,8 +129,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 86dfa0850f..6971b07bb6 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -38,7 +38,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. @@ -146,8 +146,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 c06f28de9e..02b92cde1e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -35,7 +35,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. @@ -159,8 +159,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 a17f6b7d03..784aa11aea 100644 --- a/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/StandardVolumeFlow.g.cs @@ -35,7 +35,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. @@ -135,8 +135,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 20175c551d..eee223b827 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -35,7 +35,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 : IComparableQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. @@ -137,7 +137,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 1f90689eeb..537e4f8a17 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -35,7 +35,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. @@ -136,8 +136,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 60086ffe05..a16d535dab 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -35,7 +35,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. @@ -135,8 +135,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 1fe916a88f..237c5e3016 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureGradient.g.cs @@ -35,7 +35,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. @@ -130,8 +130,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 0df1d8b6e3..06e1da77f7 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -38,7 +38,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. @@ -131,8 +131,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 3608e5da19..a1b816c177 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -35,7 +35,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. @@ -132,8 +132,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 64c4b1a46e..aadba56c99 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -35,7 +35,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. @@ -151,8 +151,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 3d5fb80f21..183483cb14 100644 --- a/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TorquePerLength.g.cs @@ -35,7 +35,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. @@ -147,8 +147,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 3203e2e106..ff765b2437 100644 --- a/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Turbidity.g.cs @@ -38,7 +38,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. @@ -130,8 +130,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 103c60e4ca..65e7664638 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -35,7 +35,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. @@ -127,8 +127,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 56851774c0..2302399cf5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -35,7 +35,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. @@ -179,8 +179,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 b336293255..b155e60c76 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeConcentration.g.cs @@ -38,7 +38,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. @@ -149,8 +149,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 42c389d36e..f266a32d9c 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -35,7 +35,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. @@ -188,8 +188,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 b0acba6eca..8cd8c02c2c 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlowPerArea.g.cs @@ -35,7 +35,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. @@ -128,8 +128,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 6e574a90b3..ed09baed8c 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumePerLength.g.cs @@ -35,7 +35,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. @@ -133,8 +133,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 577f75c0e2..34900c85b2 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumetricHeatCapacity.g.cs @@ -38,7 +38,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. @@ -138,8 +138,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 e452f6d027..d67ddeb541 100644 --- a/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/WarpingMomentOfInertia.g.cs @@ -35,7 +35,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. @@ -132,8 +132,11 @@ public WarpingMomentOfInertia(double value, UnitSystem unitSystem) /// public static WarpingMomentOfInertia Zero { get; } - #endregion + /// + public static WarpingMomentOfInertia AdditiveIdentity => Zero; + #endregion + #region Properties /// From 1cce777f4e920ab11ad6c721a97b349ad8a9264e Mon Sep 17 00:00:00 2001 From: Andreas Leeb Date: Thu, 8 Dec 2022 19:32:34 +0100 Subject: [PATCH 3/8] IParsable + codegen --- CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs | 2 +- UnitsNet/GeneratedCode/Quantities/Temperature.g.cs | 2 +- UnitsNet/IQuantity.cs | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs index c289a3a199..dbdf5674ce 100644 --- a/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs +++ b/CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs @@ -71,7 +71,7 @@ namespace UnitsNet Writer.WLIfText(1, GetObsoleteAttributeOrNull(_quantity)); Writer.W(@$" [DataContract] - public readonly partial struct {_quantity.Name} : {(_quantity.GenerateArithmetic ? "IArithmeticQuantity" : "IComparableQuantity")}<{_quantity.Name}, {_unitEnumName}, {_quantity.ValueType}>, "); + public readonly partial struct {_quantity.Name} : {(_quantity.GenerateArithmetic ? "IArithmeticQuantity" : "IQuantity")}<{_quantity.Name}, {_unitEnumName}, {_quantity.ValueType}>, "); if (_quantity.ValueType == "decimal") { Writer.W("IDecimalQuantity, "); diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index eee223b827..e3acce0819 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -35,7 +35,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 : IComparableQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable + public readonly partial struct Temperature : IQuantity, IEquatable, IComparable, IComparable, IConvertible, IFormattable { /// /// The numeric value this quantity was constructed with. diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 445f90cd2b..4bdbe9523f 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -116,29 +116,30 @@ public interface IQuantity : IQuantity where TUnitType : Enum } /// - /// An that (in .NET 7+) implements generic math interfaces for equality and comparison. + /// 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 IComparableQuantity : IQuantity + public interface IQuantity : IQuantity #if NET7_0_OR_GREATER , IEqualityOperators , IComparisonOperators + , IParsable #endif - where TSelf : IComparableQuantity + where TSelf : IQuantity where TUnitType : Enum where TValueType : struct { } /// - /// An that (in .NET 7+) implements generic math interfaces for arithmetic operations. + /// 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 : IComparableQuantity + public interface IArithmeticQuantity : IQuantity #if NET7_0_OR_GREATER , IAdditionOperators , IAdditiveIdentity From b343f7943fe335791c9ddecd06be8c8f0fc7bfbb Mon Sep 17 00:00:00 2001 From: Andreas Leeb Date: Thu, 8 Dec 2022 19:49:56 +0100 Subject: [PATCH 4/8] Unit tests .NET 7 --- UnitsNet.Tests/UnitsNet.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitsNet.Tests/UnitsNet.Tests.csproj b/UnitsNet.Tests/UnitsNet.Tests.csproj index c39367da2b..88d152ef37 100644 --- a/UnitsNet.Tests/UnitsNet.Tests.csproj +++ b/UnitsNet.Tests/UnitsNet.Tests.csproj @@ -1,7 +1,7 @@  - net6.0;net48 + net7.0;net48 UnitsNet.Tests latest true From ed27b33fa626296a577a65805e273249851c0919 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Mon, 26 Dec 2022 13:42:08 +0100 Subject: [PATCH 5/8] IQuantity: Change IDivisionOperators, add Zero property - Add `Zero` static abstract property, already implemented by all quantities. - Remove redundant `IEqualityOperators` constraint, covered by `IComparisonOperators`. - Change `IDivisionOperators` to divide by number instead of TSelf, needed for average calculation. Got error trying to keep both IDivisionOperators declarations: ``` Interface 'UnitsNet.IArithmeticQuantity' cannot implement both 'System.Numerics.IDivisionOperators' and 'System.Numerics.IDivisionOperators' because they may unify for some type parameter substitutions ``` --- UnitsNet/IQuantity.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/UnitsNet/IQuantity.cs b/UnitsNet/IQuantity.cs index 4bdbe9523f..2a2dbc60fe 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -3,7 +3,9 @@ using System; using System.Globalization; +#if NET7_0_OR_GREATER using System.Numerics; +#endif using UnitsNet.Units; namespace UnitsNet @@ -123,7 +125,6 @@ public interface IQuantity : IQuantity where TUnitType : Enum /// The underlying value type for internal representation. public interface IQuantity : IQuantity #if NET7_0_OR_GREATER - , IEqualityOperators , IComparisonOperators , IParsable #endif @@ -145,12 +146,21 @@ public interface IArithmeticQuantity : IQuantity , ISubtractionOperators , IMultiplyOperators - , IDivisionOperators + , 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 } } From 9fe4029c3166dd9621c56ff68ec6da0abaf4896f Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 28 Dec 2022 14:45:44 +0100 Subject: [PATCH 6/8] Add GenericMathExtensions and tests Add generic math implementations and tests to test out the new interfaces: - Sum - Average --- UnitsNet.Tests/GenericMathExtensionsTests.cs | 37 ++++++++++ .../DecimalGenericMathExtensions.cs | 50 +++++++++++++ UnitsNet/GenericMath/GenericMathExtensions.cs | 72 +++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 UnitsNet.Tests/GenericMathExtensionsTests.cs create mode 100644 UnitsNet/GenericMath/DecimalGenericMathExtensions.cs create mode 100644 UnitsNet/GenericMath/GenericMathExtensions.cs 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/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 From 0f4b8f91dcc4beaebb729f043b8a7cd27352ff1c Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 28 Dec 2022 15:58:51 +0100 Subject: [PATCH 7/8] Split IArithmeticQuantity to its own file --- UnitsNet/IArithmeticQuantity.cs | 37 +++++++++++++++++++++++++++++++++ UnitsNet/IQuantity.cs | 30 -------------------------- 2 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 UnitsNet/IArithmeticQuantity.cs 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 2a2dbc60fe..1ea0530d90 100644 --- a/UnitsNet/IQuantity.cs +++ b/UnitsNet/IQuantity.cs @@ -133,34 +133,4 @@ public interface IQuantity : IQuantity where TValueType : struct { } - - /// - /// 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 - } } From 65b5a1ee52ab1aaa10222a18a8d25872e4051634 Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Wed, 28 Dec 2022 15:59:32 +0100 Subject: [PATCH 8/8] Re-enable nullable, remove mute of warnings --- UnitsNet/UnitsNet.csproj | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/UnitsNet/UnitsNet.csproj b/UnitsNet/UnitsNet.csproj index 8eaaa7681a..c731aca179 100644 --- a/UnitsNet/UnitsNet.csproj +++ b/UnitsNet/UnitsNet.csproj @@ -22,7 +22,7 @@ 5.0.0.0 latest - disable + enable UnitsNet netstandard2.0;net7.0 @@ -46,22 +46,6 @@ true UnitsNet
- - 1701;1702 - 612,618,CS8769,CS8632,CS8765,CS8767 - - - 1701;1702 - 612,618,CS8769,CS8632,CS8765,CS8767 - - - 1701;1702 - 612,618,CS8769,CS8632,CS8765,CS8767 - - - 1701;1702 - 612,618,CS8769,CS8632,CS8765,CS8767 -