diff --git a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs index e7e20845d8..250a2b80d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs @@ -395,204 +395,6 @@ public static Acceleration FromStandardGravity(QuantityValue standardgravity) return new Acceleration(value, AccelerationUnit.StandardGravity); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Acceleration from nullable CentimetersPerSecondSquared. - /// - public static Acceleration? FromCentimetersPerSecondSquared(QuantityValue? centimeterspersecondsquared) - { - if (centimeterspersecondsquared.HasValue) - { - return FromCentimetersPerSecondSquared(centimeterspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable DecimetersPerSecondSquared. - /// - public static Acceleration? FromDecimetersPerSecondSquared(QuantityValue? decimeterspersecondsquared) - { - if (decimeterspersecondsquared.HasValue) - { - return FromDecimetersPerSecondSquared(decimeterspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable FeetPerSecondSquared. - /// - public static Acceleration? FromFeetPerSecondSquared(QuantityValue? feetpersecondsquared) - { - if (feetpersecondsquared.HasValue) - { - return FromFeetPerSecondSquared(feetpersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable InchesPerSecondSquared. - /// - public static Acceleration? FromInchesPerSecondSquared(QuantityValue? inchespersecondsquared) - { - if (inchespersecondsquared.HasValue) - { - return FromInchesPerSecondSquared(inchespersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable KilometersPerSecondSquared. - /// - public static Acceleration? FromKilometersPerSecondSquared(QuantityValue? kilometerspersecondsquared) - { - if (kilometerspersecondsquared.HasValue) - { - return FromKilometersPerSecondSquared(kilometerspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable KnotsPerHour. - /// - public static Acceleration? FromKnotsPerHour(QuantityValue? knotsperhour) - { - if (knotsperhour.HasValue) - { - return FromKnotsPerHour(knotsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable KnotsPerMinute. - /// - public static Acceleration? FromKnotsPerMinute(QuantityValue? knotsperminute) - { - if (knotsperminute.HasValue) - { - return FromKnotsPerMinute(knotsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable KnotsPerSecond. - /// - public static Acceleration? FromKnotsPerSecond(QuantityValue? knotspersecond) - { - if (knotspersecond.HasValue) - { - return FromKnotsPerSecond(knotspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable MetersPerSecondSquared. - /// - public static Acceleration? FromMetersPerSecondSquared(QuantityValue? meterspersecondsquared) - { - if (meterspersecondsquared.HasValue) - { - return FromMetersPerSecondSquared(meterspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable MicrometersPerSecondSquared. - /// - public static Acceleration? FromMicrometersPerSecondSquared(QuantityValue? micrometerspersecondsquared) - { - if (micrometerspersecondsquared.HasValue) - { - return FromMicrometersPerSecondSquared(micrometerspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable MillimetersPerSecondSquared. - /// - public static Acceleration? FromMillimetersPerSecondSquared(QuantityValue? millimeterspersecondsquared) - { - if (millimeterspersecondsquared.HasValue) - { - return FromMillimetersPerSecondSquared(millimeterspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable NanometersPerSecondSquared. - /// - public static Acceleration? FromNanometersPerSecondSquared(QuantityValue? nanometerspersecondsquared) - { - if (nanometerspersecondsquared.HasValue) - { - return FromNanometersPerSecondSquared(nanometerspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Acceleration from nullable StandardGravity. - /// - public static Acceleration? FromStandardGravity(QuantityValue? standardgravity) - { - if (standardgravity.HasValue) - { - return FromStandardGravity(standardgravity.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -611,25 +413,6 @@ public static Acceleration From(QuantityValue value, AccelerationUnit fromUnit) return new Acceleration((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Acceleration unit value. - public static Acceleration? From(QuantityValue? value, AccelerationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Acceleration((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -672,48 +455,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Acceleration operator -(Acceleration right) - { - return new Acceleration(-right.Value, right.Unit); - } - - public static Acceleration operator +(Acceleration left, Acceleration right) - { - return new Acceleration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Acceleration operator -(Acceleration left, Acceleration right) - { - return new Acceleration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Acceleration operator *(double left, Acceleration right) - { - return new Acceleration(left * right.Value, right.Unit); - } - - public static Acceleration operator *(Acceleration left, double right) - { - return new Acceleration(left.Value * right, left.Unit); - } - - public static Acceleration operator /(Acceleration left, double right) - { - return new Acceleration(left.Value / right, left.Unit); - } - - public static double operator /(Acceleration left, Acceleration right) - { - return left.MetersPerSecondSquared / right.MetersPerSecondSquared; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -735,43 +476,6 @@ int CompareTo(Acceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Acceleration left, Acceleration right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Acceleration left, Acceleration right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Acceleration left, Acceleration right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Acceleration left, Acceleration right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Acceleration left, Acceleration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Acceleration left, Acceleration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs index 0fc5dc7536..d7a6248f8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs @@ -413,219 +413,6 @@ public static AmountOfSubstance FromPoundMoles(QuantityValue poundmoles) return new AmountOfSubstance(value, AmountOfSubstanceUnit.PoundMole); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable AmountOfSubstance from nullable Centimoles. - /// - public static AmountOfSubstance? FromCentimoles(QuantityValue? centimoles) - { - if (centimoles.HasValue) - { - return FromCentimoles(centimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable CentipoundMoles. - /// - public static AmountOfSubstance? FromCentipoundMoles(QuantityValue? centipoundmoles) - { - if (centipoundmoles.HasValue) - { - return FromCentipoundMoles(centipoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Decimoles. - /// - public static AmountOfSubstance? FromDecimoles(QuantityValue? decimoles) - { - if (decimoles.HasValue) - { - return FromDecimoles(decimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable DecipoundMoles. - /// - public static AmountOfSubstance? FromDecipoundMoles(QuantityValue? decipoundmoles) - { - if (decipoundmoles.HasValue) - { - return FromDecipoundMoles(decipoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Kilomoles. - /// - public static AmountOfSubstance? FromKilomoles(QuantityValue? kilomoles) - { - if (kilomoles.HasValue) - { - return FromKilomoles(kilomoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable KilopoundMoles. - /// - public static AmountOfSubstance? FromKilopoundMoles(QuantityValue? kilopoundmoles) - { - if (kilopoundmoles.HasValue) - { - return FromKilopoundMoles(kilopoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Micromoles. - /// - public static AmountOfSubstance? FromMicromoles(QuantityValue? micromoles) - { - if (micromoles.HasValue) - { - return FromMicromoles(micromoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable MicropoundMoles. - /// - public static AmountOfSubstance? FromMicropoundMoles(QuantityValue? micropoundmoles) - { - if (micropoundmoles.HasValue) - { - return FromMicropoundMoles(micropoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Millimoles. - /// - public static AmountOfSubstance? FromMillimoles(QuantityValue? millimoles) - { - if (millimoles.HasValue) - { - return FromMillimoles(millimoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable MillipoundMoles. - /// - public static AmountOfSubstance? FromMillipoundMoles(QuantityValue? millipoundmoles) - { - if (millipoundmoles.HasValue) - { - return FromMillipoundMoles(millipoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Moles. - /// - public static AmountOfSubstance? FromMoles(QuantityValue? moles) - { - if (moles.HasValue) - { - return FromMoles(moles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable Nanomoles. - /// - public static AmountOfSubstance? FromNanomoles(QuantityValue? nanomoles) - { - if (nanomoles.HasValue) - { - return FromNanomoles(nanomoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable NanopoundMoles. - /// - public static AmountOfSubstance? FromNanopoundMoles(QuantityValue? nanopoundmoles) - { - if (nanopoundmoles.HasValue) - { - return FromNanopoundMoles(nanopoundmoles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmountOfSubstance from nullable PoundMoles. - /// - public static AmountOfSubstance? FromPoundMoles(QuantityValue? poundmoles) - { - if (poundmoles.HasValue) - { - return FromPoundMoles(poundmoles.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -644,25 +431,6 @@ public static AmountOfSubstance From(QuantityValue value, AmountOfSubstanceUnit return new AmountOfSubstance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AmountOfSubstance unit value. - public static AmountOfSubstance? From(QuantityValue? value, AmountOfSubstanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new AmountOfSubstance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -705,48 +473,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static AmountOfSubstance operator -(AmountOfSubstance right) - { - return new AmountOfSubstance(-right.Value, right.Unit); - } - - public static AmountOfSubstance operator +(AmountOfSubstance left, AmountOfSubstance right) - { - return new AmountOfSubstance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AmountOfSubstance operator -(AmountOfSubstance left, AmountOfSubstance right) - { - return new AmountOfSubstance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AmountOfSubstance operator *(double left, AmountOfSubstance right) - { - return new AmountOfSubstance(left * right.Value, right.Unit); - } - - public static AmountOfSubstance operator *(AmountOfSubstance left, double right) - { - return new AmountOfSubstance(left.Value * right, left.Unit); - } - - public static AmountOfSubstance operator /(AmountOfSubstance left, double right) - { - return new AmountOfSubstance(left.Value / right, left.Unit); - } - - public static double operator /(AmountOfSubstance left, AmountOfSubstance right) - { - return left.Moles / right.Moles; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -768,43 +494,6 @@ int CompareTo(AmountOfSubstance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs index aa8d246eb9..160f12638c 100644 --- a/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs @@ -223,69 +223,6 @@ public static AmplitudeRatio FromDecibelVolts(QuantityValue decibelvolts) return new AmplitudeRatio(value, AmplitudeRatioUnit.DecibelVolt); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable AmplitudeRatio from nullable DecibelMicrovolts. - /// - public static AmplitudeRatio? FromDecibelMicrovolts(QuantityValue? decibelmicrovolts) - { - if (decibelmicrovolts.HasValue) - { - return FromDecibelMicrovolts(decibelmicrovolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelMillivolts. - /// - public static AmplitudeRatio? FromDecibelMillivolts(QuantityValue? decibelmillivolts) - { - if (decibelmillivolts.HasValue) - { - return FromDecibelMillivolts(decibelmillivolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelsUnloaded. - /// - public static AmplitudeRatio? FromDecibelsUnloaded(QuantityValue? decibelsunloaded) - { - if (decibelsunloaded.HasValue) - { - return FromDecibelsUnloaded(decibelsunloaded.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AmplitudeRatio from nullable DecibelVolts. - /// - public static AmplitudeRatio? FromDecibelVolts(QuantityValue? decibelvolts) - { - if (decibelvolts.HasValue) - { - return FromDecibelVolts(decibelvolts.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -304,25 +241,6 @@ public static AmplitudeRatio From(QuantityValue value, AmplitudeRatioUnit fromUn return new AmplitudeRatio((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AmplitudeRatio unit value. - public static AmplitudeRatio? From(QuantityValue? value, AmplitudeRatioUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new AmplitudeRatio((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -365,56 +283,6 @@ public static string GetAbbreviation( #endregion - #region Logarithmic Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static AmplitudeRatio operator -(AmplitudeRatio right) - { - return new AmplitudeRatio(-right.Value, right.Unit); - } - - public static AmplitudeRatio operator +(AmplitudeRatio left, AmplitudeRatio right) - { - // Logarithmic addition - // Formula: 20*log10(10^(x/20) + 10^(y/20)) - return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/20)), left.Unit); - } - - public static AmplitudeRatio operator -(AmplitudeRatio left, AmplitudeRatio right) - { - // Logarithmic subtraction - // Formula: 20*log10(10^(x/20) - 10^(y/20)) - return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/20)), left.Unit); - } - - public static AmplitudeRatio operator *(double left, AmplitudeRatio right) - { - // Logarithmic multiplication = addition - return new AmplitudeRatio(left + right.Value, right.Unit); - } - - public static AmplitudeRatio operator *(AmplitudeRatio left, double right) - { - // Logarithmic multiplication = addition - return new AmplitudeRatio(left.Value + (double)right, left.Unit); - } - - public static AmplitudeRatio operator /(AmplitudeRatio left, double right) - { - // Logarithmic division = subtraction - return new AmplitudeRatio(left.Value - (double)right, left.Unit); - } - - public static double operator /(AmplitudeRatio left, AmplitudeRatio right) - { - // Logarithmic division = subtraction - return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -436,43 +304,6 @@ int CompareTo(AmplitudeRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs index 42519887f5..4c40e9f4be 100644 --- a/UnitsNet/GeneratedCode/Quantities/Angle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Angle.g.cs @@ -403,219 +403,6 @@ public static Angle FromRevolutions(QuantityValue revolutions) return new Angle(value, AngleUnit.Revolution); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Angle from nullable Arcminutes. - /// - public static Angle? FromArcminutes(QuantityValue? arcminutes) - { - if (arcminutes.HasValue) - { - return FromArcminutes(arcminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Arcseconds. - /// - public static Angle? FromArcseconds(QuantityValue? arcseconds) - { - if (arcseconds.HasValue) - { - return FromArcseconds(arcseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Centiradians. - /// - public static Angle? FromCentiradians(QuantityValue? centiradians) - { - if (centiradians.HasValue) - { - return FromCentiradians(centiradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Deciradians. - /// - public static Angle? FromDeciradians(QuantityValue? deciradians) - { - if (deciradians.HasValue) - { - return FromDeciradians(deciradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Degrees. - /// - public static Angle? FromDegrees(QuantityValue? degrees) - { - if (degrees.HasValue) - { - return FromDegrees(degrees.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Gradians. - /// - public static Angle? FromGradians(QuantityValue? gradians) - { - if (gradians.HasValue) - { - return FromGradians(gradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Microdegrees. - /// - public static Angle? FromMicrodegrees(QuantityValue? microdegrees) - { - if (microdegrees.HasValue) - { - return FromMicrodegrees(microdegrees.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Microradians. - /// - public static Angle? FromMicroradians(QuantityValue? microradians) - { - if (microradians.HasValue) - { - return FromMicroradians(microradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Millidegrees. - /// - public static Angle? FromMillidegrees(QuantityValue? millidegrees) - { - if (millidegrees.HasValue) - { - return FromMillidegrees(millidegrees.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Milliradians. - /// - public static Angle? FromMilliradians(QuantityValue? milliradians) - { - if (milliradians.HasValue) - { - return FromMilliradians(milliradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Nanodegrees. - /// - public static Angle? FromNanodegrees(QuantityValue? nanodegrees) - { - if (nanodegrees.HasValue) - { - return FromNanodegrees(nanodegrees.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Nanoradians. - /// - public static Angle? FromNanoradians(QuantityValue? nanoradians) - { - if (nanoradians.HasValue) - { - return FromNanoradians(nanoradians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Radians. - /// - public static Angle? FromRadians(QuantityValue? radians) - { - if (radians.HasValue) - { - return FromRadians(radians.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Angle from nullable Revolutions. - /// - public static Angle? FromRevolutions(QuantityValue? revolutions) - { - if (revolutions.HasValue) - { - return FromRevolutions(revolutions.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -634,25 +421,6 @@ public static Angle From(QuantityValue value, AngleUnit fromUnit) return new Angle((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Angle unit value. - public static Angle? From(QuantityValue? value, AngleUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Angle((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -695,48 +463,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Angle operator -(Angle right) - { - return new Angle(-right.Value, right.Unit); - } - - public static Angle operator +(Angle left, Angle right) - { - return new Angle(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Angle operator -(Angle left, Angle right) - { - return new Angle(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Angle operator *(double left, Angle right) - { - return new Angle(left * right.Value, right.Unit); - } - - public static Angle operator *(Angle left, double right) - { - return new Angle(left.Value * right, left.Unit); - } - - public static Angle operator /(Angle left, double right) - { - return new Angle(left.Value / right, left.Unit); - } - - public static double operator /(Angle left, Angle right) - { - return left.Degrees / right.Degrees; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -758,43 +484,6 @@ int CompareTo(Angle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Angle left, Angle right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Angle left, Angle right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Angle left, Angle right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Angle left, Angle right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Angle left, Angle right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Angle left, Angle right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs index 54982144bd..41d71a80ab 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs @@ -215,54 +215,6 @@ public static ApparentEnergy FromVoltampereHours(QuantityValue voltamperehours) return new ApparentEnergy(value, ApparentEnergyUnit.VoltampereHour); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ApparentEnergy from nullable KilovoltampereHours. - /// - public static ApparentEnergy? FromKilovoltampereHours(QuantityValue? kilovoltamperehours) - { - if (kilovoltamperehours.HasValue) - { - return FromKilovoltampereHours(kilovoltamperehours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ApparentEnergy from nullable MegavoltampereHours. - /// - public static ApparentEnergy? FromMegavoltampereHours(QuantityValue? megavoltamperehours) - { - if (megavoltamperehours.HasValue) - { - return FromMegavoltampereHours(megavoltamperehours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ApparentEnergy from nullable VoltampereHours. - /// - public static ApparentEnergy? FromVoltampereHours(QuantityValue? voltamperehours) - { - if (voltamperehours.HasValue) - { - return FromVoltampereHours(voltamperehours.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static ApparentEnergy From(QuantityValue value, ApparentEnergyUnit fromUn return new ApparentEnergy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ApparentEnergy unit value. - public static ApparentEnergy? From(QuantityValue? value, ApparentEnergyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ApparentEnergy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ApparentEnergy operator -(ApparentEnergy right) - { - return new ApparentEnergy(-right.Value, right.Unit); - } - - public static ApparentEnergy operator +(ApparentEnergy left, ApparentEnergy right) - { - return new ApparentEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ApparentEnergy operator -(ApparentEnergy left, ApparentEnergy right) - { - return new ApparentEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ApparentEnergy operator *(double left, ApparentEnergy right) - { - return new ApparentEnergy(left * right.Value, right.Unit); - } - - public static ApparentEnergy operator *(ApparentEnergy left, double right) - { - return new ApparentEnergy(left.Value * right, left.Unit); - } - - public static ApparentEnergy operator /(ApparentEnergy left, double right) - { - return new ApparentEnergy(left.Value / right, left.Unit); - } - - public static double operator /(ApparentEnergy left, ApparentEnergy right) - { - return left.VoltampereHours / right.VoltampereHours; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(ApparentEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ApparentEnergy left, ApparentEnergy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ApparentEnergy left, ApparentEnergy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ApparentEnergy left, ApparentEnergy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ApparentEnergy left, ApparentEnergy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ApparentEnergy left, ApparentEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ApparentEnergy left, ApparentEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs index 65e21f0a9b..10160ac505 100644 --- a/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs @@ -233,69 +233,6 @@ public static ApparentPower FromVoltamperes(QuantityValue voltamperes) return new ApparentPower(value, ApparentPowerUnit.Voltampere); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ApparentPower from nullable Gigavoltamperes. - /// - public static ApparentPower? FromGigavoltamperes(QuantityValue? gigavoltamperes) - { - if (gigavoltamperes.HasValue) - { - return FromGigavoltamperes(gigavoltamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ApparentPower from nullable Kilovoltamperes. - /// - public static ApparentPower? FromKilovoltamperes(QuantityValue? kilovoltamperes) - { - if (kilovoltamperes.HasValue) - { - return FromKilovoltamperes(kilovoltamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ApparentPower from nullable Megavoltamperes. - /// - public static ApparentPower? FromMegavoltamperes(QuantityValue? megavoltamperes) - { - if (megavoltamperes.HasValue) - { - return FromMegavoltamperes(megavoltamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ApparentPower from nullable Voltamperes. - /// - public static ApparentPower? FromVoltamperes(QuantityValue? voltamperes) - { - if (voltamperes.HasValue) - { - return FromVoltamperes(voltamperes.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static ApparentPower From(QuantityValue value, ApparentPowerUnit fromUnit return new ApparentPower((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ApparentPower unit value. - public static ApparentPower? From(QuantityValue? value, ApparentPowerUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ApparentPower((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ApparentPower operator -(ApparentPower right) - { - return new ApparentPower(-right.Value, right.Unit); - } - - public static ApparentPower operator +(ApparentPower left, ApparentPower right) - { - return new ApparentPower(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ApparentPower operator -(ApparentPower left, ApparentPower right) - { - return new ApparentPower(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ApparentPower operator *(double left, ApparentPower right) - { - return new ApparentPower(left * right.Value, right.Unit); - } - - public static ApparentPower operator *(ApparentPower left, double right) - { - return new ApparentPower(left.Value * right, left.Unit); - } - - public static ApparentPower operator /(ApparentPower left, double right) - { - return new ApparentPower(left.Value / right, left.Unit); - } - - public static double operator /(ApparentPower left, ApparentPower right) - { - return left.Voltamperes / right.Voltamperes; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(ApparentPower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ApparentPower left, ApparentPower right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ApparentPower left, ApparentPower right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ApparentPower left, ApparentPower right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ApparentPower left, ApparentPower right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ApparentPower left, ApparentPower right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ApparentPower left, ApparentPower right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Area.g.cs b/UnitsNet/GeneratedCode/Quantities/Area.g.cs index 492081b32b..681a1543ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/Area.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Area.g.cs @@ -395,204 +395,6 @@ public static Area FromUsSurveySquareFeet(QuantityValue ussurveysquarefeet) return new Area(value, AreaUnit.UsSurveySquareFoot); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Area from nullable Acres. - /// - public static Area? FromAcres(QuantityValue? acres) - { - if (acres.HasValue) - { - return FromAcres(acres.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable Hectares. - /// - public static Area? FromHectares(QuantityValue? hectares) - { - if (hectares.HasValue) - { - return FromHectares(hectares.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareCentimeters. - /// - public static Area? FromSquareCentimeters(QuantityValue? squarecentimeters) - { - if (squarecentimeters.HasValue) - { - return FromSquareCentimeters(squarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareDecimeters. - /// - public static Area? FromSquareDecimeters(QuantityValue? squaredecimeters) - { - if (squaredecimeters.HasValue) - { - return FromSquareDecimeters(squaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareFeet. - /// - public static Area? FromSquareFeet(QuantityValue? squarefeet) - { - if (squarefeet.HasValue) - { - return FromSquareFeet(squarefeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareInches. - /// - public static Area? FromSquareInches(QuantityValue? squareinches) - { - if (squareinches.HasValue) - { - return FromSquareInches(squareinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareKilometers. - /// - public static Area? FromSquareKilometers(QuantityValue? squarekilometers) - { - if (squarekilometers.HasValue) - { - return FromSquareKilometers(squarekilometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareMeters. - /// - public static Area? FromSquareMeters(QuantityValue? squaremeters) - { - if (squaremeters.HasValue) - { - return FromSquareMeters(squaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareMicrometers. - /// - public static Area? FromSquareMicrometers(QuantityValue? squaremicrometers) - { - if (squaremicrometers.HasValue) - { - return FromSquareMicrometers(squaremicrometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareMiles. - /// - public static Area? FromSquareMiles(QuantityValue? squaremiles) - { - if (squaremiles.HasValue) - { - return FromSquareMiles(squaremiles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareMillimeters. - /// - public static Area? FromSquareMillimeters(QuantityValue? squaremillimeters) - { - if (squaremillimeters.HasValue) - { - return FromSquareMillimeters(squaremillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable SquareYards. - /// - public static Area? FromSquareYards(QuantityValue? squareyards) - { - if (squareyards.HasValue) - { - return FromSquareYards(squareyards.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Area from nullable UsSurveySquareFeet. - /// - public static Area? FromUsSurveySquareFeet(QuantityValue? ussurveysquarefeet) - { - if (ussurveysquarefeet.HasValue) - { - return FromUsSurveySquareFeet(ussurveysquarefeet.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -611,25 +413,6 @@ public static Area From(QuantityValue value, AreaUnit fromUnit) return new Area((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Area unit value. - public static Area? From(QuantityValue? value, AreaUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Area((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -672,48 +455,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Area operator -(Area right) - { - return new Area(-right.Value, right.Unit); - } - - public static Area operator +(Area left, Area right) - { - return new Area(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Area operator -(Area left, Area right) - { - return new Area(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Area operator *(double left, Area right) - { - return new Area(left * right.Value, right.Unit); - } - - public static Area operator *(Area left, double right) - { - return new Area(left.Value * right, left.Unit); - } - - public static Area operator /(Area left, double right) - { - return new Area(left.Value / right, left.Unit); - } - - public static double operator /(Area left, Area right) - { - return left.SquareMeters / right.SquareMeters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -735,43 +476,6 @@ int CompareTo(Area other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Area left, Area right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Area left, Area right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Area left, Area right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Area left, Area right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Area left, Area right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Area left, Area right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs index 1f37f43fc0..4cd1480026 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs @@ -179,24 +179,6 @@ public static AreaDensity FromKilogramsPerSquareMeter(QuantityValue kilogramsper return new AreaDensity(value, AreaDensityUnit.KilogramPerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable AreaDensity from nullable KilogramsPerSquareMeter. - /// - public static AreaDensity? FromKilogramsPerSquareMeter(QuantityValue? kilogramspersquaremeter) - { - if (kilogramspersquaremeter.HasValue) - { - return FromKilogramsPerSquareMeter(kilogramspersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static AreaDensity From(QuantityValue value, AreaDensityUnit fromUnit) return new AreaDensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AreaDensity unit value. - public static AreaDensity? From(QuantityValue? value, AreaDensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new AreaDensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static AreaDensity operator -(AreaDensity right) - { - return new AreaDensity(-right.Value, right.Unit); - } - - public static AreaDensity operator +(AreaDensity left, AreaDensity right) - { - return new AreaDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AreaDensity operator -(AreaDensity left, AreaDensity right) - { - return new AreaDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AreaDensity operator *(double left, AreaDensity right) - { - return new AreaDensity(left * right.Value, right.Unit); - } - - public static AreaDensity operator *(AreaDensity left, double right) - { - return new AreaDensity(left.Value * right, left.Unit); - } - - public static AreaDensity operator /(AreaDensity left, double right) - { - return new AreaDensity(left.Value / right, left.Unit); - } - - public static double operator /(AreaDensity left, AreaDensity right) - { - return left.KilogramsPerSquareMeter / right.KilogramsPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(AreaDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(AreaDensity left, AreaDensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(AreaDensity left, AreaDensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(AreaDensity left, AreaDensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(AreaDensity left, AreaDensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(AreaDensity left, AreaDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(AreaDensity left, AreaDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs index 6c119c7ef9..2bf08ecf41 100644 --- a/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs @@ -269,99 +269,6 @@ public static AreaMomentOfInertia FromMillimetersToTheFourth(QuantityValue milli return new AreaMomentOfInertia(value, AreaMomentOfInertiaUnit.MillimeterToTheFourth); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable AreaMomentOfInertia from nullable CentimetersToTheFourth. - /// - public static AreaMomentOfInertia? FromCentimetersToTheFourth(QuantityValue? centimeterstothefourth) - { - if (centimeterstothefourth.HasValue) - { - return FromCentimetersToTheFourth(centimeterstothefourth.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AreaMomentOfInertia from nullable DecimetersToTheFourth. - /// - public static AreaMomentOfInertia? FromDecimetersToTheFourth(QuantityValue? decimeterstothefourth) - { - if (decimeterstothefourth.HasValue) - { - return FromDecimetersToTheFourth(decimeterstothefourth.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AreaMomentOfInertia from nullable FeetToTheFourth. - /// - public static AreaMomentOfInertia? FromFeetToTheFourth(QuantityValue? feettothefourth) - { - if (feettothefourth.HasValue) - { - return FromFeetToTheFourth(feettothefourth.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AreaMomentOfInertia from nullable InchesToTheFourth. - /// - public static AreaMomentOfInertia? FromInchesToTheFourth(QuantityValue? inchestothefourth) - { - if (inchestothefourth.HasValue) - { - return FromInchesToTheFourth(inchestothefourth.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AreaMomentOfInertia from nullable MetersToTheFourth. - /// - public static AreaMomentOfInertia? FromMetersToTheFourth(QuantityValue? meterstothefourth) - { - if (meterstothefourth.HasValue) - { - return FromMetersToTheFourth(meterstothefourth.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable AreaMomentOfInertia from nullable MillimetersToTheFourth. - /// - public static AreaMomentOfInertia? FromMillimetersToTheFourth(QuantityValue? millimeterstothefourth) - { - if (millimeterstothefourth.HasValue) - { - return FromMillimetersToTheFourth(millimeterstothefourth.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -380,25 +287,6 @@ public static AreaMomentOfInertia From(QuantityValue value, AreaMomentOfInertiaU return new AreaMomentOfInertia((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// AreaMomentOfInertia unit value. - public static AreaMomentOfInertia? From(QuantityValue? value, AreaMomentOfInertiaUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new AreaMomentOfInertia((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -441,48 +329,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static AreaMomentOfInertia operator -(AreaMomentOfInertia right) - { - return new AreaMomentOfInertia(-right.Value, right.Unit); - } - - public static AreaMomentOfInertia operator +(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return new AreaMomentOfInertia(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AreaMomentOfInertia operator -(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return new AreaMomentOfInertia(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static AreaMomentOfInertia operator *(double left, AreaMomentOfInertia right) - { - return new AreaMomentOfInertia(left * right.Value, right.Unit); - } - - public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, double right) - { - return new AreaMomentOfInertia(left.Value * right, left.Unit); - } - - public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, double right) - { - return new AreaMomentOfInertia(left.Value / right, left.Unit); - } - - public static double operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return left.MetersToTheFourth / right.MetersToTheFourth; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -504,43 +350,6 @@ int CompareTo(AreaMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs index 5f3889646d..c4df3df6ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BitRate.g.cs @@ -619,399 +619,6 @@ public static BitRate FromTerabytesPerSecond(QuantityValue terabytespersecond) return new BitRate(value, BitRateUnit.TerabytePerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable BitRate from nullable BitsPerSecond. - /// - public static BitRate? FromBitsPerSecond(QuantityValue? bitspersecond) - { - if (bitspersecond.HasValue) - { - return FromBitsPerSecond(bitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable BytesPerSecond. - /// - public static BitRate? FromBytesPerSecond(QuantityValue? bytespersecond) - { - if (bytespersecond.HasValue) - { - return FromBytesPerSecond(bytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable ExabitsPerSecond. - /// - public static BitRate? FromExabitsPerSecond(QuantityValue? exabitspersecond) - { - if (exabitspersecond.HasValue) - { - return FromExabitsPerSecond(exabitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable ExabytesPerSecond. - /// - public static BitRate? FromExabytesPerSecond(QuantityValue? exabytespersecond) - { - if (exabytespersecond.HasValue) - { - return FromExabytesPerSecond(exabytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable ExbibitsPerSecond. - /// - public static BitRate? FromExbibitsPerSecond(QuantityValue? exbibitspersecond) - { - if (exbibitspersecond.HasValue) - { - return FromExbibitsPerSecond(exbibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable ExbibytesPerSecond. - /// - public static BitRate? FromExbibytesPerSecond(QuantityValue? exbibytespersecond) - { - if (exbibytespersecond.HasValue) - { - return FromExbibytesPerSecond(exbibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable GibibitsPerSecond. - /// - public static BitRate? FromGibibitsPerSecond(QuantityValue? gibibitspersecond) - { - if (gibibitspersecond.HasValue) - { - return FromGibibitsPerSecond(gibibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable GibibytesPerSecond. - /// - public static BitRate? FromGibibytesPerSecond(QuantityValue? gibibytespersecond) - { - if (gibibytespersecond.HasValue) - { - return FromGibibytesPerSecond(gibibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable GigabitsPerSecond. - /// - public static BitRate? FromGigabitsPerSecond(QuantityValue? gigabitspersecond) - { - if (gigabitspersecond.HasValue) - { - return FromGigabitsPerSecond(gigabitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable GigabytesPerSecond. - /// - public static BitRate? FromGigabytesPerSecond(QuantityValue? gigabytespersecond) - { - if (gigabytespersecond.HasValue) - { - return FromGigabytesPerSecond(gigabytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable KibibitsPerSecond. - /// - public static BitRate? FromKibibitsPerSecond(QuantityValue? kibibitspersecond) - { - if (kibibitspersecond.HasValue) - { - return FromKibibitsPerSecond(kibibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable KibibytesPerSecond. - /// - public static BitRate? FromKibibytesPerSecond(QuantityValue? kibibytespersecond) - { - if (kibibytespersecond.HasValue) - { - return FromKibibytesPerSecond(kibibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable KilobitsPerSecond. - /// - public static BitRate? FromKilobitsPerSecond(QuantityValue? kilobitspersecond) - { - if (kilobitspersecond.HasValue) - { - return FromKilobitsPerSecond(kilobitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable KilobytesPerSecond. - /// - public static BitRate? FromKilobytesPerSecond(QuantityValue? kilobytespersecond) - { - if (kilobytespersecond.HasValue) - { - return FromKilobytesPerSecond(kilobytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable MebibitsPerSecond. - /// - public static BitRate? FromMebibitsPerSecond(QuantityValue? mebibitspersecond) - { - if (mebibitspersecond.HasValue) - { - return FromMebibitsPerSecond(mebibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable MebibytesPerSecond. - /// - public static BitRate? FromMebibytesPerSecond(QuantityValue? mebibytespersecond) - { - if (mebibytespersecond.HasValue) - { - return FromMebibytesPerSecond(mebibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable MegabitsPerSecond. - /// - public static BitRate? FromMegabitsPerSecond(QuantityValue? megabitspersecond) - { - if (megabitspersecond.HasValue) - { - return FromMegabitsPerSecond(megabitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable MegabytesPerSecond. - /// - public static BitRate? FromMegabytesPerSecond(QuantityValue? megabytespersecond) - { - if (megabytespersecond.HasValue) - { - return FromMegabytesPerSecond(megabytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable PebibitsPerSecond. - /// - public static BitRate? FromPebibitsPerSecond(QuantityValue? pebibitspersecond) - { - if (pebibitspersecond.HasValue) - { - return FromPebibitsPerSecond(pebibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable PebibytesPerSecond. - /// - public static BitRate? FromPebibytesPerSecond(QuantityValue? pebibytespersecond) - { - if (pebibytespersecond.HasValue) - { - return FromPebibytesPerSecond(pebibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable PetabitsPerSecond. - /// - public static BitRate? FromPetabitsPerSecond(QuantityValue? petabitspersecond) - { - if (petabitspersecond.HasValue) - { - return FromPetabitsPerSecond(petabitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable PetabytesPerSecond. - /// - public static BitRate? FromPetabytesPerSecond(QuantityValue? petabytespersecond) - { - if (petabytespersecond.HasValue) - { - return FromPetabytesPerSecond(petabytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable TebibitsPerSecond. - /// - public static BitRate? FromTebibitsPerSecond(QuantityValue? tebibitspersecond) - { - if (tebibitspersecond.HasValue) - { - return FromTebibitsPerSecond(tebibitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable TebibytesPerSecond. - /// - public static BitRate? FromTebibytesPerSecond(QuantityValue? tebibytespersecond) - { - if (tebibytespersecond.HasValue) - { - return FromTebibytesPerSecond(tebibytespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable TerabitsPerSecond. - /// - public static BitRate? FromTerabitsPerSecond(QuantityValue? terabitspersecond) - { - if (terabitspersecond.HasValue) - { - return FromTerabitsPerSecond(terabitspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BitRate from nullable TerabytesPerSecond. - /// - public static BitRate? FromTerabytesPerSecond(QuantityValue? terabytespersecond) - { - if (terabytespersecond.HasValue) - { - return FromTerabytesPerSecond(terabytespersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1030,25 +637,6 @@ public static BitRate From(QuantityValue value, BitRateUnit fromUnit) return new BitRate((decimal)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// BitRate unit value. - public static BitRate? From(QuantityValue? value, BitRateUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new BitRate((decimal)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1091,48 +679,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static BitRate operator -(BitRate right) - { - return new BitRate(-right.Value, right.Unit); - } - - public static BitRate operator +(BitRate left, BitRate right) - { - return new BitRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static BitRate operator -(BitRate left, BitRate right) - { - return new BitRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static BitRate operator *(decimal left, BitRate right) - { - return new BitRate(left * right.Value, right.Unit); - } - - public static BitRate operator *(BitRate left, decimal right) - { - return new BitRate(left.Value * right, left.Unit); - } - - public static BitRate operator /(BitRate left, decimal right) - { - return new BitRate(left.Value / right, left.Unit); - } - - public static double operator /(BitRate left, BitRate right) - { - return left.BitsPerSecond / right.BitsPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1154,41 +700,6 @@ int CompareTo(BitRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(BitRate left, BitRate right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(BitRate left, BitRate right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(BitRate left, BitRate right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(BitRate left, BitRate right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - public static bool operator ==(BitRate left, BitRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - public static bool operator !=(BitRate left, BitRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - public override bool Equals(object obj) { if(obj is null || !(obj is BitRate)) diff --git a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs index 905e1c0034..565945bad5 100644 --- a/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/BrakeSpecificFuelConsumption.g.cs @@ -215,54 +215,6 @@ public static BrakeSpecificFuelConsumption FromPoundsPerMechanicalHorsepowerHour return new BrakeSpecificFuelConsumption(value, BrakeSpecificFuelConsumptionUnit.PoundPerMechanicalHorsepowerHour); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable GramsPerKiloWattHour. - /// - public static BrakeSpecificFuelConsumption? FromGramsPerKiloWattHour(QuantityValue? gramsperkilowatthour) - { - if (gramsperkilowatthour.HasValue) - { - return FromGramsPerKiloWattHour(gramsperkilowatthour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable KilogramsPerJoule. - /// - public static BrakeSpecificFuelConsumption? FromKilogramsPerJoule(QuantityValue? kilogramsperjoule) - { - if (kilogramsperjoule.HasValue) - { - return FromKilogramsPerJoule(kilogramsperjoule.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable BrakeSpecificFuelConsumption from nullable PoundsPerMechanicalHorsepowerHour. - /// - public static BrakeSpecificFuelConsumption? FromPoundsPerMechanicalHorsepowerHour(QuantityValue? poundspermechanicalhorsepowerhour) - { - if (poundspermechanicalhorsepowerhour.HasValue) - { - return FromPoundsPerMechanicalHorsepowerHour(poundspermechanicalhorsepowerhour.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static BrakeSpecificFuelConsumption From(QuantityValue value, BrakeSpecif return new BrakeSpecificFuelConsumption((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// BrakeSpecificFuelConsumption unit value. - public static BrakeSpecificFuelConsumption? From(QuantityValue? value, BrakeSpecificFuelConsumptionUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new BrakeSpecificFuelConsumption((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption right) - { - return new BrakeSpecificFuelConsumption(-right.Value, right.Unit); - } - - public static BrakeSpecificFuelConsumption operator +(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return new BrakeSpecificFuelConsumption(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return new BrakeSpecificFuelConsumption(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static BrakeSpecificFuelConsumption operator *(double left, BrakeSpecificFuelConsumption right) - { - return new BrakeSpecificFuelConsumption(left * right.Value, right.Unit); - } - - public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, double right) - { - return new BrakeSpecificFuelConsumption(left.Value * right, left.Unit); - } - - public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, double right) - { - return new BrakeSpecificFuelConsumption(left.Value / right, left.Unit); - } - - public static double operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return left.KilogramsPerJoule / right.KilogramsPerJoule; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(BrakeSpecificFuelConsumption other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs index f2e91b6ec3..36da798e39 100644 --- a/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs @@ -179,24 +179,6 @@ public static Capacitance FromFarads(QuantityValue farads) return new Capacitance(value, CapacitanceUnit.Farad); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Capacitance from nullable Farads. - /// - public static Capacitance? FromFarads(QuantityValue? farads) - { - if (farads.HasValue) - { - return FromFarads(farads.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static Capacitance From(QuantityValue value, CapacitanceUnit fromUnit) return new Capacitance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Capacitance unit value. - public static Capacitance? From(QuantityValue? value, CapacitanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Capacitance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Capacitance operator -(Capacitance right) - { - return new Capacitance(-right.Value, right.Unit); - } - - public static Capacitance operator +(Capacitance left, Capacitance right) - { - return new Capacitance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Capacitance operator -(Capacitance left, Capacitance right) - { - return new Capacitance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Capacitance operator *(double left, Capacitance right) - { - return new Capacitance(left * right.Value, right.Unit); - } - - public static Capacitance operator *(Capacitance left, double right) - { - return new Capacitance(left.Value * right, left.Unit); - } - - public static Capacitance operator /(Capacitance left, double right) - { - return new Capacitance(left.Value / right, left.Unit); - } - - public static double operator /(Capacitance left, Capacitance right) - { - return left.Farads / right.Farads; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(Capacitance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Capacitance left, Capacitance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Capacitance left, Capacitance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Capacitance left, Capacitance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Capacitance left, Capacitance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Capacitance left, Capacitance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Capacitance left, Capacitance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Density.g.cs b/UnitsNet/GeneratedCode/Quantities/Density.g.cs index 5d49e29f02..62cfbe9ef5 100644 --- a/UnitsNet/GeneratedCode/Quantities/Density.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Density.g.cs @@ -845,579 +845,6 @@ public static Density FromTonnesPerCubicMillimeter(QuantityValue tonnespercubicm return new Density(value, DensityUnit.TonnePerCubicMillimeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Density from nullable CentigramsPerDeciLiter. - /// - public static Density? FromCentigramsPerDeciLiter(QuantityValue? centigramsperdeciliter) - { - if (centigramsperdeciliter.HasValue) - { - return FromCentigramsPerDeciLiter(centigramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable CentigramsPerLiter. - /// - public static Density? FromCentigramsPerLiter(QuantityValue? centigramsperliter) - { - if (centigramsperliter.HasValue) - { - return FromCentigramsPerLiter(centigramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable CentigramsPerMilliliter. - /// - public static Density? FromCentigramsPerMilliliter(QuantityValue? centigramspermilliliter) - { - if (centigramspermilliliter.HasValue) - { - return FromCentigramsPerMilliliter(centigramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable DecigramsPerDeciLiter. - /// - public static Density? FromDecigramsPerDeciLiter(QuantityValue? decigramsperdeciliter) - { - if (decigramsperdeciliter.HasValue) - { - return FromDecigramsPerDeciLiter(decigramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable DecigramsPerLiter. - /// - public static Density? FromDecigramsPerLiter(QuantityValue? decigramsperliter) - { - if (decigramsperliter.HasValue) - { - return FromDecigramsPerLiter(decigramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable DecigramsPerMilliliter. - /// - public static Density? FromDecigramsPerMilliliter(QuantityValue? decigramspermilliliter) - { - if (decigramspermilliliter.HasValue) - { - return FromDecigramsPerMilliliter(decigramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerCubicCentimeter. - /// - public static Density? FromGramsPerCubicCentimeter(QuantityValue? gramspercubiccentimeter) - { - if (gramspercubiccentimeter.HasValue) - { - return FromGramsPerCubicCentimeter(gramspercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerCubicMeter. - /// - public static Density? FromGramsPerCubicMeter(QuantityValue? gramspercubicmeter) - { - if (gramspercubicmeter.HasValue) - { - return FromGramsPerCubicMeter(gramspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerCubicMillimeter. - /// - public static Density? FromGramsPerCubicMillimeter(QuantityValue? gramspercubicmillimeter) - { - if (gramspercubicmillimeter.HasValue) - { - return FromGramsPerCubicMillimeter(gramspercubicmillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerDeciLiter. - /// - public static Density? FromGramsPerDeciLiter(QuantityValue? gramsperdeciliter) - { - if (gramsperdeciliter.HasValue) - { - return FromGramsPerDeciLiter(gramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerLiter. - /// - public static Density? FromGramsPerLiter(QuantityValue? gramsperliter) - { - if (gramsperliter.HasValue) - { - return FromGramsPerLiter(gramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable GramsPerMilliliter. - /// - public static Density? FromGramsPerMilliliter(QuantityValue? gramspermilliliter) - { - if (gramspermilliliter.HasValue) - { - return FromGramsPerMilliliter(gramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicCentimeter. - /// - public static Density? FromKilogramsPerCubicCentimeter(QuantityValue? kilogramspercubiccentimeter) - { - if (kilogramspercubiccentimeter.HasValue) - { - return FromKilogramsPerCubicCentimeter(kilogramspercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicMeter. - /// - public static Density? FromKilogramsPerCubicMeter(QuantityValue? kilogramspercubicmeter) - { - if (kilogramspercubicmeter.HasValue) - { - return FromKilogramsPerCubicMeter(kilogramspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable KilogramsPerCubicMillimeter. - /// - public static Density? FromKilogramsPerCubicMillimeter(QuantityValue? kilogramspercubicmillimeter) - { - if (kilogramspercubicmillimeter.HasValue) - { - return FromKilogramsPerCubicMillimeter(kilogramspercubicmillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable KilopoundsPerCubicFoot. - /// - public static Density? FromKilopoundsPerCubicFoot(QuantityValue? kilopoundspercubicfoot) - { - if (kilopoundspercubicfoot.HasValue) - { - return FromKilopoundsPerCubicFoot(kilopoundspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable KilopoundsPerCubicInch. - /// - public static Density? FromKilopoundsPerCubicInch(QuantityValue? kilopoundspercubicinch) - { - if (kilopoundspercubicinch.HasValue) - { - return FromKilopoundsPerCubicInch(kilopoundspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MicrogramsPerDeciLiter. - /// - public static Density? FromMicrogramsPerDeciLiter(QuantityValue? microgramsperdeciliter) - { - if (microgramsperdeciliter.HasValue) - { - return FromMicrogramsPerDeciLiter(microgramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MicrogramsPerLiter. - /// - public static Density? FromMicrogramsPerLiter(QuantityValue? microgramsperliter) - { - if (microgramsperliter.HasValue) - { - return FromMicrogramsPerLiter(microgramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MicrogramsPerMilliliter. - /// - public static Density? FromMicrogramsPerMilliliter(QuantityValue? microgramspermilliliter) - { - if (microgramspermilliliter.HasValue) - { - return FromMicrogramsPerMilliliter(microgramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MilligramsPerCubicMeter. - /// - public static Density? FromMilligramsPerCubicMeter(QuantityValue? milligramspercubicmeter) - { - if (milligramspercubicmeter.HasValue) - { - return FromMilligramsPerCubicMeter(milligramspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MilligramsPerDeciLiter. - /// - public static Density? FromMilligramsPerDeciLiter(QuantityValue? milligramsperdeciliter) - { - if (milligramsperdeciliter.HasValue) - { - return FromMilligramsPerDeciLiter(milligramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MilligramsPerLiter. - /// - public static Density? FromMilligramsPerLiter(QuantityValue? milligramsperliter) - { - if (milligramsperliter.HasValue) - { - return FromMilligramsPerLiter(milligramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable MilligramsPerMilliliter. - /// - public static Density? FromMilligramsPerMilliliter(QuantityValue? milligramspermilliliter) - { - if (milligramspermilliliter.HasValue) - { - return FromMilligramsPerMilliliter(milligramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable NanogramsPerDeciLiter. - /// - public static Density? FromNanogramsPerDeciLiter(QuantityValue? nanogramsperdeciliter) - { - if (nanogramsperdeciliter.HasValue) - { - return FromNanogramsPerDeciLiter(nanogramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable NanogramsPerLiter. - /// - public static Density? FromNanogramsPerLiter(QuantityValue? nanogramsperliter) - { - if (nanogramsperliter.HasValue) - { - return FromNanogramsPerLiter(nanogramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable NanogramsPerMilliliter. - /// - public static Density? FromNanogramsPerMilliliter(QuantityValue? nanogramspermilliliter) - { - if (nanogramspermilliliter.HasValue) - { - return FromNanogramsPerMilliliter(nanogramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PicogramsPerDeciLiter. - /// - public static Density? FromPicogramsPerDeciLiter(QuantityValue? picogramsperdeciliter) - { - if (picogramsperdeciliter.HasValue) - { - return FromPicogramsPerDeciLiter(picogramsperdeciliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PicogramsPerLiter. - /// - public static Density? FromPicogramsPerLiter(QuantityValue? picogramsperliter) - { - if (picogramsperliter.HasValue) - { - return FromPicogramsPerLiter(picogramsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PicogramsPerMilliliter. - /// - public static Density? FromPicogramsPerMilliliter(QuantityValue? picogramspermilliliter) - { - if (picogramspermilliliter.HasValue) - { - return FromPicogramsPerMilliliter(picogramspermilliliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PoundsPerCubicFoot. - /// - public static Density? FromPoundsPerCubicFoot(QuantityValue? poundspercubicfoot) - { - if (poundspercubicfoot.HasValue) - { - return FromPoundsPerCubicFoot(poundspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PoundsPerCubicInch. - /// - public static Density? FromPoundsPerCubicInch(QuantityValue? poundspercubicinch) - { - if (poundspercubicinch.HasValue) - { - return FromPoundsPerCubicInch(poundspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PoundsPerImperialGallon. - /// - public static Density? FromPoundsPerImperialGallon(QuantityValue? poundsperimperialgallon) - { - if (poundsperimperialgallon.HasValue) - { - return FromPoundsPerImperialGallon(poundsperimperialgallon.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable PoundsPerUSGallon. - /// - public static Density? FromPoundsPerUSGallon(QuantityValue? poundsperusgallon) - { - if (poundsperusgallon.HasValue) - { - return FromPoundsPerUSGallon(poundsperusgallon.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable SlugsPerCubicFoot. - /// - public static Density? FromSlugsPerCubicFoot(QuantityValue? slugspercubicfoot) - { - if (slugspercubicfoot.HasValue) - { - return FromSlugsPerCubicFoot(slugspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable TonnesPerCubicCentimeter. - /// - public static Density? FromTonnesPerCubicCentimeter(QuantityValue? tonnespercubiccentimeter) - { - if (tonnespercubiccentimeter.HasValue) - { - return FromTonnesPerCubicCentimeter(tonnespercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable TonnesPerCubicMeter. - /// - public static Density? FromTonnesPerCubicMeter(QuantityValue? tonnespercubicmeter) - { - if (tonnespercubicmeter.HasValue) - { - return FromTonnesPerCubicMeter(tonnespercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Density from nullable TonnesPerCubicMillimeter. - /// - public static Density? FromTonnesPerCubicMillimeter(QuantityValue? tonnespercubicmillimeter) - { - if (tonnespercubicmillimeter.HasValue) - { - return FromTonnesPerCubicMillimeter(tonnespercubicmillimeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1436,25 +863,6 @@ public static Density From(QuantityValue value, DensityUnit fromUnit) return new Density((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Density unit value. - public static Density? From(QuantityValue? value, DensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Density((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1497,48 +905,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Density operator -(Density right) - { - return new Density(-right.Value, right.Unit); - } - - public static Density operator +(Density left, Density right) - { - return new Density(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Density operator -(Density left, Density right) - { - return new Density(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Density operator *(double left, Density right) - { - return new Density(left * right.Value, right.Unit); - } - - public static Density operator *(Density left, double right) - { - return new Density(left.Value * right, left.Unit); - } - - public static Density operator /(Density left, double right) - { - return new Density(left.Value / right, left.Unit); - } - - public static double operator /(Density left, Density right) - { - return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1560,43 +926,6 @@ int CompareTo(Density other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Density left, Density right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Density left, Density right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Density left, Density right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Density left, Density right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Density left, Density right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Density left, Density right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs index f04710f991..bfde8ab53a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Duration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Duration.g.cs @@ -379,189 +379,6 @@ public static Duration FromYears365(QuantityValue years365) return new Duration(value, DurationUnit.Year365); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Duration from nullable Days. - /// - public static Duration? FromDays(QuantityValue? days) - { - if (days.HasValue) - { - return FromDays(days.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Hours. - /// - public static Duration? FromHours(QuantityValue? hours) - { - if (hours.HasValue) - { - return FromHours(hours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Microseconds. - /// - public static Duration? FromMicroseconds(QuantityValue? microseconds) - { - if (microseconds.HasValue) - { - return FromMicroseconds(microseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Milliseconds. - /// - public static Duration? FromMilliseconds(QuantityValue? milliseconds) - { - if (milliseconds.HasValue) - { - return FromMilliseconds(milliseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Minutes. - /// - public static Duration? FromMinutes(QuantityValue? minutes) - { - if (minutes.HasValue) - { - return FromMinutes(minutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Months. - /// - public static Duration? FromMonths(QuantityValue? months) - { - if (months.HasValue) - { - return FromMonths(months.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Months30. - /// - public static Duration? FromMonths30(QuantityValue? months30) - { - if (months30.HasValue) - { - return FromMonths30(months30.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Nanoseconds. - /// - public static Duration? FromNanoseconds(QuantityValue? nanoseconds) - { - if (nanoseconds.HasValue) - { - return FromNanoseconds(nanoseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Seconds. - /// - public static Duration? FromSeconds(QuantityValue? seconds) - { - if (seconds.HasValue) - { - return FromSeconds(seconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Weeks. - /// - public static Duration? FromWeeks(QuantityValue? weeks) - { - if (weeks.HasValue) - { - return FromWeeks(weeks.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Years. - /// - public static Duration? FromYears(QuantityValue? years) - { - if (years.HasValue) - { - return FromYears(years.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Duration from nullable Years365. - /// - public static Duration? FromYears365(QuantityValue? years365) - { - if (years365.HasValue) - { - return FromYears365(years365.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -580,25 +397,6 @@ public static Duration From(QuantityValue value, DurationUnit fromUnit) return new Duration((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Duration unit value. - public static Duration? From(QuantityValue? value, DurationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Duration((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -641,48 +439,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Duration operator -(Duration right) - { - return new Duration(-right.Value, right.Unit); - } - - public static Duration operator +(Duration left, Duration right) - { - return new Duration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Duration operator -(Duration left, Duration right) - { - return new Duration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Duration operator *(double left, Duration right) - { - return new Duration(left * right.Value, right.Unit); - } - - public static Duration operator *(Duration left, double right) - { - return new Duration(left.Value * right, left.Unit); - } - - public static Duration operator /(Duration left, double right) - { - return new Duration(left.Value / right, left.Unit); - } - - public static double operator /(Duration left, Duration right) - { - return left.Seconds / right.Seconds; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -704,43 +460,6 @@ int CompareTo(Duration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Duration left, Duration right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Duration left, Duration right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Duration left, Duration right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Duration left, Duration right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Duration left, Duration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Duration left, Duration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs index 099c30a2e2..41ed5dc63b 100644 --- a/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs @@ -269,99 +269,6 @@ public static DynamicViscosity FromPoise(QuantityValue poise) return new DynamicViscosity(value, DynamicViscosityUnit.Poise); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable DynamicViscosity from nullable Centipoise. - /// - public static DynamicViscosity? FromCentipoise(QuantityValue? centipoise) - { - if (centipoise.HasValue) - { - return FromCentipoise(centipoise.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable DynamicViscosity from nullable MicropascalSeconds. - /// - public static DynamicViscosity? FromMicropascalSeconds(QuantityValue? micropascalseconds) - { - if (micropascalseconds.HasValue) - { - return FromMicropascalSeconds(micropascalseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable DynamicViscosity from nullable MillipascalSeconds. - /// - public static DynamicViscosity? FromMillipascalSeconds(QuantityValue? millipascalseconds) - { - if (millipascalseconds.HasValue) - { - return FromMillipascalSeconds(millipascalseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable DynamicViscosity from nullable NewtonSecondsPerMeterSquared. - /// - public static DynamicViscosity? FromNewtonSecondsPerMeterSquared(QuantityValue? newtonsecondspermetersquared) - { - if (newtonsecondspermetersquared.HasValue) - { - return FromNewtonSecondsPerMeterSquared(newtonsecondspermetersquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable DynamicViscosity from nullable PascalSeconds. - /// - public static DynamicViscosity? FromPascalSeconds(QuantityValue? pascalseconds) - { - if (pascalseconds.HasValue) - { - return FromPascalSeconds(pascalseconds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable DynamicViscosity from nullable Poise. - /// - public static DynamicViscosity? FromPoise(QuantityValue? poise) - { - if (poise.HasValue) - { - return FromPoise(poise.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -380,25 +287,6 @@ public static DynamicViscosity From(QuantityValue value, DynamicViscosityUnit fr return new DynamicViscosity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// DynamicViscosity unit value. - public static DynamicViscosity? From(QuantityValue? value, DynamicViscosityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new DynamicViscosity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -441,48 +329,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static DynamicViscosity operator -(DynamicViscosity right) - { - return new DynamicViscosity(-right.Value, right.Unit); - } - - public static DynamicViscosity operator +(DynamicViscosity left, DynamicViscosity right) - { - return new DynamicViscosity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static DynamicViscosity operator -(DynamicViscosity left, DynamicViscosity right) - { - return new DynamicViscosity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static DynamicViscosity operator *(double left, DynamicViscosity right) - { - return new DynamicViscosity(left * right.Value, right.Unit); - } - - public static DynamicViscosity operator *(DynamicViscosity left, double right) - { - return new DynamicViscosity(left.Value * right, left.Unit); - } - - public static DynamicViscosity operator /(DynamicViscosity left, double right) - { - return new DynamicViscosity(left.Value / right, left.Unit); - } - - public static double operator /(DynamicViscosity left, DynamicViscosity right) - { - return left.NewtonSecondsPerMeterSquared / right.NewtonSecondsPerMeterSquared; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -504,43 +350,6 @@ int CompareTo(DynamicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(DynamicViscosity left, DynamicViscosity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(DynamicViscosity left, DynamicViscosity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(DynamicViscosity left, DynamicViscosity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(DynamicViscosity left, DynamicViscosity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(DynamicViscosity left, DynamicViscosity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(DynamicViscosity left, DynamicViscosity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs index 807b4f37e4..a147cfce19 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs @@ -233,69 +233,6 @@ public static ElectricAdmittance FromSiemens(QuantityValue siemens) return new ElectricAdmittance(value, ElectricAdmittanceUnit.Siemens); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricAdmittance from nullable Microsiemens. - /// - public static ElectricAdmittance? FromMicrosiemens(QuantityValue? microsiemens) - { - if (microsiemens.HasValue) - { - return FromMicrosiemens(microsiemens.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricAdmittance from nullable Millisiemens. - /// - public static ElectricAdmittance? FromMillisiemens(QuantityValue? millisiemens) - { - if (millisiemens.HasValue) - { - return FromMillisiemens(millisiemens.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricAdmittance from nullable Nanosiemens. - /// - public static ElectricAdmittance? FromNanosiemens(QuantityValue? nanosiemens) - { - if (nanosiemens.HasValue) - { - return FromNanosiemens(nanosiemens.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricAdmittance from nullable Siemens. - /// - public static ElectricAdmittance? FromSiemens(QuantityValue? siemens) - { - if (siemens.HasValue) - { - return FromSiemens(siemens.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static ElectricAdmittance From(QuantityValue value, ElectricAdmittanceUni return new ElectricAdmittance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricAdmittance unit value. - public static ElectricAdmittance? From(QuantityValue? value, ElectricAdmittanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricAdmittance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricAdmittance operator -(ElectricAdmittance right) - { - return new ElectricAdmittance(-right.Value, right.Unit); - } - - public static ElectricAdmittance operator +(ElectricAdmittance left, ElectricAdmittance right) - { - return new ElectricAdmittance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricAdmittance operator -(ElectricAdmittance left, ElectricAdmittance right) - { - return new ElectricAdmittance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricAdmittance operator *(double left, ElectricAdmittance right) - { - return new ElectricAdmittance(left * right.Value, right.Unit); - } - - public static ElectricAdmittance operator *(ElectricAdmittance left, double right) - { - return new ElectricAdmittance(left.Value * right, left.Unit); - } - - public static ElectricAdmittance operator /(ElectricAdmittance left, double right) - { - return new ElectricAdmittance(left.Value / right, left.Unit); - } - - public static double operator /(ElectricAdmittance left, ElectricAdmittance right) - { - return left.Siemens / right.Siemens; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(ElectricAdmittance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs index 4731d44632..0e62ddfe82 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs @@ -179,24 +179,6 @@ public static ElectricCharge FromCoulombs(QuantityValue coulombs) return new ElectricCharge(value, ElectricChargeUnit.Coulomb); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricCharge from nullable Coulombs. - /// - public static ElectricCharge? FromCoulombs(QuantityValue? coulombs) - { - if (coulombs.HasValue) - { - return FromCoulombs(coulombs.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricCharge From(QuantityValue value, ElectricChargeUnit fromUn return new ElectricCharge((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCharge unit value. - public static ElectricCharge? From(QuantityValue? value, ElectricChargeUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricCharge((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricCharge operator -(ElectricCharge right) - { - return new ElectricCharge(-right.Value, right.Unit); - } - - public static ElectricCharge operator +(ElectricCharge left, ElectricCharge right) - { - return new ElectricCharge(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCharge operator -(ElectricCharge left, ElectricCharge right) - { - return new ElectricCharge(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCharge operator *(double left, ElectricCharge right) - { - return new ElectricCharge(left * right.Value, right.Unit); - } - - public static ElectricCharge operator *(ElectricCharge left, double right) - { - return new ElectricCharge(left.Value * right, left.Unit); - } - - public static ElectricCharge operator /(ElectricCharge left, double right) - { - return new ElectricCharge(left.Value / right, left.Unit); - } - - public static double operator /(ElectricCharge left, ElectricCharge right) - { - return left.Coulombs / right.Coulombs; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricCharge other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricCharge left, ElectricCharge right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricCharge left, ElectricCharge right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricCharge left, ElectricCharge right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricCharge left, ElectricCharge right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricCharge left, ElectricCharge right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricCharge left, ElectricCharge right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs index d72e04c40b..0150b1705e 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs @@ -179,24 +179,6 @@ public static ElectricChargeDensity FromCoulombsPerCubicMeter(QuantityValue coul return new ElectricChargeDensity(value, ElectricChargeDensityUnit.CoulombPerCubicMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricChargeDensity from nullable CoulombsPerCubicMeter. - /// - public static ElectricChargeDensity? FromCoulombsPerCubicMeter(QuantityValue? coulombspercubicmeter) - { - if (coulombspercubicmeter.HasValue) - { - return FromCoulombsPerCubicMeter(coulombspercubicmeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricChargeDensity From(QuantityValue value, ElectricChargeDens return new ElectricChargeDensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricChargeDensity unit value. - public static ElectricChargeDensity? From(QuantityValue? value, ElectricChargeDensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricChargeDensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricChargeDensity operator -(ElectricChargeDensity right) - { - return new ElectricChargeDensity(-right.Value, right.Unit); - } - - public static ElectricChargeDensity operator +(ElectricChargeDensity left, ElectricChargeDensity right) - { - return new ElectricChargeDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricChargeDensity operator -(ElectricChargeDensity left, ElectricChargeDensity right) - { - return new ElectricChargeDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricChargeDensity operator *(double left, ElectricChargeDensity right) - { - return new ElectricChargeDensity(left * right.Value, right.Unit); - } - - public static ElectricChargeDensity operator *(ElectricChargeDensity left, double right) - { - return new ElectricChargeDensity(left.Value * right, left.Unit); - } - - public static ElectricChargeDensity operator /(ElectricChargeDensity left, double right) - { - return new ElectricChargeDensity(left.Value / right, left.Unit); - } - - public static double operator /(ElectricChargeDensity left, ElectricChargeDensity right) - { - return left.CoulombsPerCubicMeter / right.CoulombsPerCubicMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricChargeDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricChargeDensity left, ElectricChargeDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricChargeDensity left, ElectricChargeDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs index fec10f938e..1afb7193f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs @@ -215,54 +215,6 @@ public static ElectricConductance FromSiemens(QuantityValue siemens) return new ElectricConductance(value, ElectricConductanceUnit.Siemens); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricConductance from nullable Microsiemens. - /// - public static ElectricConductance? FromMicrosiemens(QuantityValue? microsiemens) - { - if (microsiemens.HasValue) - { - return FromMicrosiemens(microsiemens.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricConductance from nullable Millisiemens. - /// - public static ElectricConductance? FromMillisiemens(QuantityValue? millisiemens) - { - if (millisiemens.HasValue) - { - return FromMillisiemens(millisiemens.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricConductance from nullable Siemens. - /// - public static ElectricConductance? FromSiemens(QuantityValue? siemens) - { - if (siemens.HasValue) - { - return FromSiemens(siemens.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static ElectricConductance From(QuantityValue value, ElectricConductanceU return new ElectricConductance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricConductance unit value. - public static ElectricConductance? From(QuantityValue? value, ElectricConductanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricConductance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricConductance operator -(ElectricConductance right) - { - return new ElectricConductance(-right.Value, right.Unit); - } - - public static ElectricConductance operator +(ElectricConductance left, ElectricConductance right) - { - return new ElectricConductance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricConductance operator -(ElectricConductance left, ElectricConductance right) - { - return new ElectricConductance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricConductance operator *(double left, ElectricConductance right) - { - return new ElectricConductance(left * right.Value, right.Unit); - } - - public static ElectricConductance operator *(ElectricConductance left, double right) - { - return new ElectricConductance(left.Value * right, left.Unit); - } - - public static ElectricConductance operator /(ElectricConductance left, double right) - { - return new ElectricConductance(left.Value / right, left.Unit); - } - - public static double operator /(ElectricConductance left, ElectricConductance right) - { - return left.Siemens / right.Siemens; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(ElectricConductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricConductance left, ElectricConductance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricConductance left, ElectricConductance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricConductance left, ElectricConductance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricConductance left, ElectricConductance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricConductance left, ElectricConductance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricConductance left, ElectricConductance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs index a9d89dddd1..fef4d55b58 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs @@ -179,24 +179,6 @@ public static ElectricConductivity FromSiemensPerMeter(QuantityValue siemensperm return new ElectricConductivity(value, ElectricConductivityUnit.SiemensPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricConductivity from nullable SiemensPerMeter. - /// - public static ElectricConductivity? FromSiemensPerMeter(QuantityValue? siemenspermeter) - { - if (siemenspermeter.HasValue) - { - return FromSiemensPerMeter(siemenspermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricConductivity From(QuantityValue value, ElectricConductivit return new ElectricConductivity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricConductivity unit value. - public static ElectricConductivity? From(QuantityValue? value, ElectricConductivityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricConductivity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricConductivity operator -(ElectricConductivity right) - { - return new ElectricConductivity(-right.Value, right.Unit); - } - - public static ElectricConductivity operator +(ElectricConductivity left, ElectricConductivity right) - { - return new ElectricConductivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricConductivity operator -(ElectricConductivity left, ElectricConductivity right) - { - return new ElectricConductivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricConductivity operator *(double left, ElectricConductivity right) - { - return new ElectricConductivity(left * right.Value, right.Unit); - } - - public static ElectricConductivity operator *(ElectricConductivity left, double right) - { - return new ElectricConductivity(left.Value * right, left.Unit); - } - - public static ElectricConductivity operator /(ElectricConductivity left, double right) - { - return new ElectricConductivity(left.Value / right, left.Unit); - } - - public static double operator /(ElectricConductivity left, ElectricConductivity right) - { - return left.SiemensPerMeter / right.SiemensPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricConductivity left, ElectricConductivity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricConductivity left, ElectricConductivity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricConductivity left, ElectricConductivity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricConductivity left, ElectricConductivity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricConductivity left, ElectricConductivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricConductivity left, ElectricConductivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs index 7887f2d07c..7a31e9c2cf 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs @@ -287,114 +287,6 @@ public static ElectricCurrent FromPicoamperes(QuantityValue picoamperes) return new ElectricCurrent(value, ElectricCurrentUnit.Picoampere); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricCurrent from nullable Amperes. - /// - public static ElectricCurrent? FromAmperes(QuantityValue? amperes) - { - if (amperes.HasValue) - { - return FromAmperes(amperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Kiloamperes. - /// - public static ElectricCurrent? FromKiloamperes(QuantityValue? kiloamperes) - { - if (kiloamperes.HasValue) - { - return FromKiloamperes(kiloamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Megaamperes. - /// - public static ElectricCurrent? FromMegaamperes(QuantityValue? megaamperes) - { - if (megaamperes.HasValue) - { - return FromMegaamperes(megaamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Microamperes. - /// - public static ElectricCurrent? FromMicroamperes(QuantityValue? microamperes) - { - if (microamperes.HasValue) - { - return FromMicroamperes(microamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Milliamperes. - /// - public static ElectricCurrent? FromMilliamperes(QuantityValue? milliamperes) - { - if (milliamperes.HasValue) - { - return FromMilliamperes(milliamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Nanoamperes. - /// - public static ElectricCurrent? FromNanoamperes(QuantityValue? nanoamperes) - { - if (nanoamperes.HasValue) - { - return FromNanoamperes(nanoamperes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricCurrent from nullable Picoamperes. - /// - public static ElectricCurrent? FromPicoamperes(QuantityValue? picoamperes) - { - if (picoamperes.HasValue) - { - return FromPicoamperes(picoamperes.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -413,25 +305,6 @@ public static ElectricCurrent From(QuantityValue value, ElectricCurrentUnit from return new ElectricCurrent((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrent unit value. - public static ElectricCurrent? From(QuantityValue? value, ElectricCurrentUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricCurrent((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -474,48 +347,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricCurrent operator -(ElectricCurrent right) - { - return new ElectricCurrent(-right.Value, right.Unit); - } - - public static ElectricCurrent operator +(ElectricCurrent left, ElectricCurrent right) - { - return new ElectricCurrent(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrent operator -(ElectricCurrent left, ElectricCurrent right) - { - return new ElectricCurrent(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrent operator *(double left, ElectricCurrent right) - { - return new ElectricCurrent(left * right.Value, right.Unit); - } - - public static ElectricCurrent operator *(ElectricCurrent left, double right) - { - return new ElectricCurrent(left.Value * right, left.Unit); - } - - public static ElectricCurrent operator /(ElectricCurrent left, double right) - { - return new ElectricCurrent(left.Value / right, left.Unit); - } - - public static double operator /(ElectricCurrent left, ElectricCurrent right) - { - return left.Amperes / right.Amperes; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -537,43 +368,6 @@ int CompareTo(ElectricCurrent other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricCurrent left, ElectricCurrent right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricCurrent left, ElectricCurrent right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricCurrent left, ElectricCurrent right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricCurrent left, ElectricCurrent right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricCurrent left, ElectricCurrent right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricCurrent left, ElectricCurrent right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs index 5542ec04eb..29aae0a998 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentDensity.g.cs @@ -179,24 +179,6 @@ public static ElectricCurrentDensity FromAmperesPerSquareMeter(QuantityValue amp return new ElectricCurrentDensity(value, ElectricCurrentDensityUnit.AmperePerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricCurrentDensity from nullable AmperesPerSquareMeter. - /// - public static ElectricCurrentDensity? FromAmperesPerSquareMeter(QuantityValue? amperespersquaremeter) - { - if (amperespersquaremeter.HasValue) - { - return FromAmperesPerSquareMeter(amperespersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricCurrentDensity From(QuantityValue value, ElectricCurrentDe return new ElectricCurrentDensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrentDensity unit value. - public static ElectricCurrentDensity? From(QuantityValue? value, ElectricCurrentDensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricCurrentDensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricCurrentDensity operator -(ElectricCurrentDensity right) - { - return new ElectricCurrentDensity(-right.Value, right.Unit); - } - - public static ElectricCurrentDensity operator +(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return new ElectricCurrentDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrentDensity operator -(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return new ElectricCurrentDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrentDensity operator *(double left, ElectricCurrentDensity right) - { - return new ElectricCurrentDensity(left * right.Value, right.Unit); - } - - public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, double right) - { - return new ElectricCurrentDensity(left.Value * right, left.Unit); - } - - public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, double right) - { - return new ElectricCurrentDensity(left.Value / right, left.Unit); - } - - public static double operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return left.AmperesPerSquareMeter / right.AmperesPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricCurrentDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricCurrentDensity left, ElectricCurrentDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs index ccc1bbdf8e..e41cfc9c98 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricCurrentGradient.g.cs @@ -179,24 +179,6 @@ public static ElectricCurrentGradient FromAmperesPerSecond(QuantityValue amperes return new ElectricCurrentGradient(value, ElectricCurrentGradientUnit.AmperePerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricCurrentGradient from nullable AmperesPerSecond. - /// - public static ElectricCurrentGradient? FromAmperesPerSecond(QuantityValue? amperespersecond) - { - if (amperespersecond.HasValue) - { - return FromAmperesPerSecond(amperespersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricCurrentGradient From(QuantityValue value, ElectricCurrentG return new ElectricCurrentGradient((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricCurrentGradient unit value. - public static ElectricCurrentGradient? From(QuantityValue? value, ElectricCurrentGradientUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricCurrentGradient((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricCurrentGradient operator -(ElectricCurrentGradient right) - { - return new ElectricCurrentGradient(-right.Value, right.Unit); - } - - public static ElectricCurrentGradient operator +(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return new ElectricCurrentGradient(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrentGradient operator -(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return new ElectricCurrentGradient(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricCurrentGradient operator *(double left, ElectricCurrentGradient right) - { - return new ElectricCurrentGradient(left * right.Value, right.Unit); - } - - public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, double right) - { - return new ElectricCurrentGradient(left.Value * right, left.Unit); - } - - public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, double right) - { - return new ElectricCurrentGradient(left.Value / right, left.Unit); - } - - public static double operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return left.AmperesPerSecond / right.AmperesPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricCurrentGradient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricCurrentGradient left, ElectricCurrentGradient right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs index 49ef2fb146..4f5984bf90 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricField.g.cs @@ -179,24 +179,6 @@ public static ElectricField FromVoltsPerMeter(QuantityValue voltspermeter) return new ElectricField(value, ElectricFieldUnit.VoltPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricField from nullable VoltsPerMeter. - /// - public static ElectricField? FromVoltsPerMeter(QuantityValue? voltspermeter) - { - if (voltspermeter.HasValue) - { - return FromVoltsPerMeter(voltspermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricField From(QuantityValue value, ElectricFieldUnit fromUnit return new ElectricField((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricField unit value. - public static ElectricField? From(QuantityValue? value, ElectricFieldUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricField((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricField operator -(ElectricField right) - { - return new ElectricField(-right.Value, right.Unit); - } - - public static ElectricField operator +(ElectricField left, ElectricField right) - { - return new ElectricField(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricField operator -(ElectricField left, ElectricField right) - { - return new ElectricField(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricField operator *(double left, ElectricField right) - { - return new ElectricField(left * right.Value, right.Unit); - } - - public static ElectricField operator *(ElectricField left, double right) - { - return new ElectricField(left.Value * right, left.Unit); - } - - public static ElectricField operator /(ElectricField left, double right) - { - return new ElectricField(left.Value / right, left.Unit); - } - - public static double operator /(ElectricField left, ElectricField right) - { - return left.VoltsPerMeter / right.VoltsPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricField left, ElectricField right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricField left, ElectricField right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricField left, ElectricField right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricField left, ElectricField right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricField left, ElectricField right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricField left, ElectricField right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs index 62f6dbb8f3..f3ece2d00a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricInductance.g.cs @@ -179,24 +179,6 @@ public static ElectricInductance FromHenries(QuantityValue henries) return new ElectricInductance(value, ElectricInductanceUnit.Henry); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricInductance from nullable Henries. - /// - public static ElectricInductance? FromHenries(QuantityValue? henries) - { - if (henries.HasValue) - { - return FromHenries(henries.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static ElectricInductance From(QuantityValue value, ElectricInductanceUni return new ElectricInductance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricInductance unit value. - public static ElectricInductance? From(QuantityValue? value, ElectricInductanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricInductance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricInductance operator -(ElectricInductance right) - { - return new ElectricInductance(-right.Value, right.Unit); - } - - public static ElectricInductance operator +(ElectricInductance left, ElectricInductance right) - { - return new ElectricInductance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricInductance operator -(ElectricInductance left, ElectricInductance right) - { - return new ElectricInductance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricInductance operator *(double left, ElectricInductance right) - { - return new ElectricInductance(left * right.Value, right.Unit); - } - - public static ElectricInductance operator *(ElectricInductance left, double right) - { - return new ElectricInductance(left.Value * right, left.Unit); - } - - public static ElectricInductance operator /(ElectricInductance left, double right) - { - return new ElectricInductance(left.Value / right, left.Unit); - } - - public static double operator /(ElectricInductance left, ElectricInductance right) - { - return left.Henries / right.Henries; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(ElectricInductance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricInductance left, ElectricInductance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricInductance left, ElectricInductance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricInductance left, ElectricInductance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricInductance left, ElectricInductance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricInductance left, ElectricInductance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricInductance left, ElectricInductance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs index 413290eaa8..48eac4c38c 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotential.g.cs @@ -251,84 +251,6 @@ public static ElectricPotential FromVolts(QuantityValue volts) return new ElectricPotential(value, ElectricPotentialUnit.Volt); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricPotential from nullable Kilovolts. - /// - public static ElectricPotential? FromKilovolts(QuantityValue? kilovolts) - { - if (kilovolts.HasValue) - { - return FromKilovolts(kilovolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotential from nullable Megavolts. - /// - public static ElectricPotential? FromMegavolts(QuantityValue? megavolts) - { - if (megavolts.HasValue) - { - return FromMegavolts(megavolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotential from nullable Microvolts. - /// - public static ElectricPotential? FromMicrovolts(QuantityValue? microvolts) - { - if (microvolts.HasValue) - { - return FromMicrovolts(microvolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotential from nullable Millivolts. - /// - public static ElectricPotential? FromMillivolts(QuantityValue? millivolts) - { - if (millivolts.HasValue) - { - return FromMillivolts(millivolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotential from nullable Volts. - /// - public static ElectricPotential? FromVolts(QuantityValue? volts) - { - if (volts.HasValue) - { - return FromVolts(volts.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -347,25 +269,6 @@ public static ElectricPotential From(QuantityValue value, ElectricPotentialUnit return new ElectricPotential((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotential unit value. - public static ElectricPotential? From(QuantityValue? value, ElectricPotentialUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricPotential((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -408,48 +311,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricPotential operator -(ElectricPotential right) - { - return new ElectricPotential(-right.Value, right.Unit); - } - - public static ElectricPotential operator +(ElectricPotential left, ElectricPotential right) - { - return new ElectricPotential(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotential operator -(ElectricPotential left, ElectricPotential right) - { - return new ElectricPotential(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotential operator *(double left, ElectricPotential right) - { - return new ElectricPotential(left * right.Value, right.Unit); - } - - public static ElectricPotential operator *(ElectricPotential left, double right) - { - return new ElectricPotential(left.Value * right, left.Unit); - } - - public static ElectricPotential operator /(ElectricPotential left, double right) - { - return new ElectricPotential(left.Value / right, left.Unit); - } - - public static double operator /(ElectricPotential left, ElectricPotential right) - { - return left.Volts / right.Volts; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -471,43 +332,6 @@ int CompareTo(ElectricPotential other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricPotential left, ElectricPotential right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricPotential left, ElectricPotential right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricPotential left, ElectricPotential right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricPotential left, ElectricPotential right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricPotential left, ElectricPotential right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricPotential left, ElectricPotential right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs index 931fc0d829..f2017b1f92 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialAc.g.cs @@ -241,84 +241,6 @@ public static ElectricPotentialAc FromVoltsAc(QuantityValue voltsac) return new ElectricPotentialAc(value, ElectricPotentialAcUnit.VoltAc); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricPotentialAc from nullable KilovoltsAc. - /// - public static ElectricPotentialAc? FromKilovoltsAc(QuantityValue? kilovoltsac) - { - if (kilovoltsac.HasValue) - { - return FromKilovoltsAc(kilovoltsac.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialAc from nullable MegavoltsAc. - /// - public static ElectricPotentialAc? FromMegavoltsAc(QuantityValue? megavoltsac) - { - if (megavoltsac.HasValue) - { - return FromMegavoltsAc(megavoltsac.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialAc from nullable MicrovoltsAc. - /// - public static ElectricPotentialAc? FromMicrovoltsAc(QuantityValue? microvoltsac) - { - if (microvoltsac.HasValue) - { - return FromMicrovoltsAc(microvoltsac.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialAc from nullable MillivoltsAc. - /// - public static ElectricPotentialAc? FromMillivoltsAc(QuantityValue? millivoltsac) - { - if (millivoltsac.HasValue) - { - return FromMillivoltsAc(millivoltsac.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialAc from nullable VoltsAc. - /// - public static ElectricPotentialAc? FromVoltsAc(QuantityValue? voltsac) - { - if (voltsac.HasValue) - { - return FromVoltsAc(voltsac.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -337,25 +259,6 @@ public static ElectricPotentialAc From(QuantityValue value, ElectricPotentialAcU return new ElectricPotentialAc((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotentialAc unit value. - public static ElectricPotentialAc? From(QuantityValue? value, ElectricPotentialAcUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricPotentialAc((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -398,48 +301,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricPotentialAc operator -(ElectricPotentialAc right) - { - return new ElectricPotentialAc(-right.Value, right.Unit); - } - - public static ElectricPotentialAc operator +(ElectricPotentialAc left, ElectricPotentialAc right) - { - return new ElectricPotentialAc(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotentialAc operator -(ElectricPotentialAc left, ElectricPotentialAc right) - { - return new ElectricPotentialAc(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotentialAc operator *(double left, ElectricPotentialAc right) - { - return new ElectricPotentialAc(left * right.Value, right.Unit); - } - - public static ElectricPotentialAc operator *(ElectricPotentialAc left, double right) - { - return new ElectricPotentialAc(left.Value * right, left.Unit); - } - - public static ElectricPotentialAc operator /(ElectricPotentialAc left, double right) - { - return new ElectricPotentialAc(left.Value / right, left.Unit); - } - - public static double operator /(ElectricPotentialAc left, ElectricPotentialAc right) - { - return left.VoltsAc / right.VoltsAc; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -461,43 +322,6 @@ int CompareTo(ElectricPotentialAc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricPotentialAc left, ElectricPotentialAc right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricPotentialAc left, ElectricPotentialAc right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs index 48cae36a0d..120547defb 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricPotentialDc.g.cs @@ -241,84 +241,6 @@ public static ElectricPotentialDc FromVoltsDc(QuantityValue voltsdc) return new ElectricPotentialDc(value, ElectricPotentialDcUnit.VoltDc); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricPotentialDc from nullable KilovoltsDc. - /// - public static ElectricPotentialDc? FromKilovoltsDc(QuantityValue? kilovoltsdc) - { - if (kilovoltsdc.HasValue) - { - return FromKilovoltsDc(kilovoltsdc.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialDc from nullable MegavoltsDc. - /// - public static ElectricPotentialDc? FromMegavoltsDc(QuantityValue? megavoltsdc) - { - if (megavoltsdc.HasValue) - { - return FromMegavoltsDc(megavoltsdc.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialDc from nullable MicrovoltsDc. - /// - public static ElectricPotentialDc? FromMicrovoltsDc(QuantityValue? microvoltsdc) - { - if (microvoltsdc.HasValue) - { - return FromMicrovoltsDc(microvoltsdc.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialDc from nullable MillivoltsDc. - /// - public static ElectricPotentialDc? FromMillivoltsDc(QuantityValue? millivoltsdc) - { - if (millivoltsdc.HasValue) - { - return FromMillivoltsDc(millivoltsdc.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricPotentialDc from nullable VoltsDc. - /// - public static ElectricPotentialDc? FromVoltsDc(QuantityValue? voltsdc) - { - if (voltsdc.HasValue) - { - return FromVoltsDc(voltsdc.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -337,25 +259,6 @@ public static ElectricPotentialDc From(QuantityValue value, ElectricPotentialDcU return new ElectricPotentialDc((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricPotentialDc unit value. - public static ElectricPotentialDc? From(QuantityValue? value, ElectricPotentialDcUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricPotentialDc((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -398,48 +301,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricPotentialDc operator -(ElectricPotentialDc right) - { - return new ElectricPotentialDc(-right.Value, right.Unit); - } - - public static ElectricPotentialDc operator +(ElectricPotentialDc left, ElectricPotentialDc right) - { - return new ElectricPotentialDc(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotentialDc operator -(ElectricPotentialDc left, ElectricPotentialDc right) - { - return new ElectricPotentialDc(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricPotentialDc operator *(double left, ElectricPotentialDc right) - { - return new ElectricPotentialDc(left * right.Value, right.Unit); - } - - public static ElectricPotentialDc operator *(ElectricPotentialDc left, double right) - { - return new ElectricPotentialDc(left.Value * right, left.Unit); - } - - public static ElectricPotentialDc operator /(ElectricPotentialDc left, double right) - { - return new ElectricPotentialDc(left.Value / right, left.Unit); - } - - public static double operator /(ElectricPotentialDc left, ElectricPotentialDc right) - { - return left.VoltsDc / right.VoltsDc; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -461,43 +322,6 @@ int CompareTo(ElectricPotentialDc other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricPotentialDc left, ElectricPotentialDc right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricPotentialDc left, ElectricPotentialDc right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs index e2fe573728..b055ead35f 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistance.g.cs @@ -233,69 +233,6 @@ public static ElectricResistance FromOhms(QuantityValue ohms) return new ElectricResistance(value, ElectricResistanceUnit.Ohm); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricResistance from nullable Kiloohms. - /// - public static ElectricResistance? FromKiloohms(QuantityValue? kiloohms) - { - if (kiloohms.HasValue) - { - return FromKiloohms(kiloohms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistance from nullable Megaohms. - /// - public static ElectricResistance? FromMegaohms(QuantityValue? megaohms) - { - if (megaohms.HasValue) - { - return FromMegaohms(megaohms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistance from nullable Milliohms. - /// - public static ElectricResistance? FromMilliohms(QuantityValue? milliohms) - { - if (milliohms.HasValue) - { - return FromMilliohms(milliohms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistance from nullable Ohms. - /// - public static ElectricResistance? FromOhms(QuantityValue? ohms) - { - if (ohms.HasValue) - { - return FromOhms(ohms.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static ElectricResistance From(QuantityValue value, ElectricResistanceUni return new ElectricResistance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricResistance unit value. - public static ElectricResistance? From(QuantityValue? value, ElectricResistanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricResistance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricResistance operator -(ElectricResistance right) - { - return new ElectricResistance(-right.Value, right.Unit); - } - - public static ElectricResistance operator +(ElectricResistance left, ElectricResistance right) - { - return new ElectricResistance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricResistance operator -(ElectricResistance left, ElectricResistance right) - { - return new ElectricResistance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricResistance operator *(double left, ElectricResistance right) - { - return new ElectricResistance(left * right.Value, right.Unit); - } - - public static ElectricResistance operator *(ElectricResistance left, double right) - { - return new ElectricResistance(left.Value * right, left.Unit); - } - - public static ElectricResistance operator /(ElectricResistance left, double right) - { - return new ElectricResistance(left.Value / right, left.Unit); - } - - public static double operator /(ElectricResistance left, ElectricResistance right) - { - return left.Ohms / right.Ohms; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(ElectricResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricResistance left, ElectricResistance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricResistance left, ElectricResistance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricResistance left, ElectricResistance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricResistance left, ElectricResistance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricResistance left, ElectricResistance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricResistance left, ElectricResistance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs index f6c14c75c0..8ec40ed01a 100644 --- a/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ElectricResistivity.g.cs @@ -233,69 +233,6 @@ public static ElectricResistivity FromOhmMeters(QuantityValue ohmmeters) return new ElectricResistivity(value, ElectricResistivityUnit.OhmMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ElectricResistivity from nullable MicroohmMeters. - /// - public static ElectricResistivity? FromMicroohmMeters(QuantityValue? microohmmeters) - { - if (microohmmeters.HasValue) - { - return FromMicroohmMeters(microohmmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistivity from nullable MilliohmMeters. - /// - public static ElectricResistivity? FromMilliohmMeters(QuantityValue? milliohmmeters) - { - if (milliohmmeters.HasValue) - { - return FromMilliohmMeters(milliohmmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistivity from nullable NanoohmMeters. - /// - public static ElectricResistivity? FromNanoohmMeters(QuantityValue? nanoohmmeters) - { - if (nanoohmmeters.HasValue) - { - return FromNanoohmMeters(nanoohmmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ElectricResistivity from nullable OhmMeters. - /// - public static ElectricResistivity? FromOhmMeters(QuantityValue? ohmmeters) - { - if (ohmmeters.HasValue) - { - return FromOhmMeters(ohmmeters.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static ElectricResistivity From(QuantityValue value, ElectricResistivityU return new ElectricResistivity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ElectricResistivity unit value. - public static ElectricResistivity? From(QuantityValue? value, ElectricResistivityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ElectricResistivity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ElectricResistivity operator -(ElectricResistivity right) - { - return new ElectricResistivity(-right.Value, right.Unit); - } - - public static ElectricResistivity operator +(ElectricResistivity left, ElectricResistivity right) - { - return new ElectricResistivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricResistivity operator -(ElectricResistivity left, ElectricResistivity right) - { - return new ElectricResistivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ElectricResistivity operator *(double left, ElectricResistivity right) - { - return new ElectricResistivity(left * right.Value, right.Unit); - } - - public static ElectricResistivity operator *(ElectricResistivity left, double right) - { - return new ElectricResistivity(left.Value * right, left.Unit); - } - - public static ElectricResistivity operator /(ElectricResistivity left, double right) - { - return new ElectricResistivity(left.Value / right, left.Unit); - } - - public static double operator /(ElectricResistivity left, ElectricResistivity right) - { - return left.OhmMeters / right.OhmMeters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(ElectricResistivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ElectricResistivity left, ElectricResistivity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ElectricResistivity left, ElectricResistivity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ElectricResistivity left, ElectricResistivity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ElectricResistivity left, ElectricResistivity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ElectricResistivity left, ElectricResistivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ElectricResistivity left, ElectricResistivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs index fb271c295a..59947a415a 100644 --- a/UnitsNet/GeneratedCode/Quantities/Energy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Energy.g.cs @@ -557,339 +557,6 @@ public static Energy FromWattHours(QuantityValue watthours) return new Energy(value, EnergyUnit.WattHour); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Energy from nullable BritishThermalUnits. - /// - public static Energy? FromBritishThermalUnits(QuantityValue? britishthermalunits) - { - if (britishthermalunits.HasValue) - { - return FromBritishThermalUnits(britishthermalunits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Calories. - /// - public static Energy? FromCalories(QuantityValue? calories) - { - if (calories.HasValue) - { - return FromCalories(calories.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable DecathermsEc. - /// - public static Energy? FromDecathermsEc(QuantityValue? decathermsec) - { - if (decathermsec.HasValue) - { - return FromDecathermsEc(decathermsec.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable DecathermsImperial. - /// - public static Energy? FromDecathermsImperial(QuantityValue? decathermsimperial) - { - if (decathermsimperial.HasValue) - { - return FromDecathermsImperial(decathermsimperial.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable DecathermsUs. - /// - public static Energy? FromDecathermsUs(QuantityValue? decathermsus) - { - if (decathermsus.HasValue) - { - return FromDecathermsUs(decathermsus.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable ElectronVolts. - /// - public static Energy? FromElectronVolts(QuantityValue? electronvolts) - { - if (electronvolts.HasValue) - { - return FromElectronVolts(electronvolts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Ergs. - /// - public static Energy? FromErgs(QuantityValue? ergs) - { - if (ergs.HasValue) - { - return FromErgs(ergs.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable FootPounds. - /// - public static Energy? FromFootPounds(QuantityValue? footpounds) - { - if (footpounds.HasValue) - { - return FromFootPounds(footpounds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable GigabritishThermalUnits. - /// - public static Energy? FromGigabritishThermalUnits(QuantityValue? gigabritishthermalunits) - { - if (gigabritishthermalunits.HasValue) - { - return FromGigabritishThermalUnits(gigabritishthermalunits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable GigawattHours. - /// - public static Energy? FromGigawattHours(QuantityValue? gigawatthours) - { - if (gigawatthours.HasValue) - { - return FromGigawattHours(gigawatthours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Joules. - /// - public static Energy? FromJoules(QuantityValue? joules) - { - if (joules.HasValue) - { - return FromJoules(joules.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable KilobritishThermalUnits. - /// - public static Energy? FromKilobritishThermalUnits(QuantityValue? kilobritishthermalunits) - { - if (kilobritishthermalunits.HasValue) - { - return FromKilobritishThermalUnits(kilobritishthermalunits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Kilocalories. - /// - public static Energy? FromKilocalories(QuantityValue? kilocalories) - { - if (kilocalories.HasValue) - { - return FromKilocalories(kilocalories.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Kilojoules. - /// - public static Energy? FromKilojoules(QuantityValue? kilojoules) - { - if (kilojoules.HasValue) - { - return FromKilojoules(kilojoules.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable KilowattHours. - /// - public static Energy? FromKilowattHours(QuantityValue? kilowatthours) - { - if (kilowatthours.HasValue) - { - return FromKilowattHours(kilowatthours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable MegabritishThermalUnits. - /// - public static Energy? FromMegabritishThermalUnits(QuantityValue? megabritishthermalunits) - { - if (megabritishthermalunits.HasValue) - { - return FromMegabritishThermalUnits(megabritishthermalunits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable Megajoules. - /// - public static Energy? FromMegajoules(QuantityValue? megajoules) - { - if (megajoules.HasValue) - { - return FromMegajoules(megajoules.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable MegawattHours. - /// - public static Energy? FromMegawattHours(QuantityValue? megawatthours) - { - if (megawatthours.HasValue) - { - return FromMegawattHours(megawatthours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable ThermsEc. - /// - public static Energy? FromThermsEc(QuantityValue? thermsec) - { - if (thermsec.HasValue) - { - return FromThermsEc(thermsec.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable ThermsImperial. - /// - public static Energy? FromThermsImperial(QuantityValue? thermsimperial) - { - if (thermsimperial.HasValue) - { - return FromThermsImperial(thermsimperial.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable ThermsUs. - /// - public static Energy? FromThermsUs(QuantityValue? thermsus) - { - if (thermsus.HasValue) - { - return FromThermsUs(thermsus.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Energy from nullable WattHours. - /// - public static Energy? FromWattHours(QuantityValue? watthours) - { - if (watthours.HasValue) - { - return FromWattHours(watthours.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -908,25 +575,6 @@ public static Energy From(QuantityValue value, EnergyUnit fromUnit) return new Energy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Energy unit value. - public static Energy? From(QuantityValue? value, EnergyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Energy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -969,48 +617,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Energy operator -(Energy right) - { - return new Energy(-right.Value, right.Unit); - } - - public static Energy operator +(Energy left, Energy right) - { - return new Energy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Energy operator -(Energy left, Energy right) - { - return new Energy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Energy operator *(double left, Energy right) - { - return new Energy(left * right.Value, right.Unit); - } - - public static Energy operator *(Energy left, double right) - { - return new Energy(left.Value * right, left.Unit); - } - - public static Energy operator /(Energy left, double right) - { - return new Energy(left.Value / right, left.Unit); - } - - public static double operator /(Energy left, Energy right) - { - return left.Joules / right.Joules; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1032,43 +638,6 @@ int CompareTo(Energy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Energy left, Energy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Energy left, Energy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Energy left, Energy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Energy left, Energy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Energy left, Energy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Energy left, Energy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs index ffd91dde8b..07f507dc2f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Entropy.g.cs @@ -287,114 +287,6 @@ public static Entropy FromMegajoulesPerKelvin(QuantityValue megajoulesperkelvin) return new Entropy(value, EntropyUnit.MegajoulePerKelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Entropy from nullable CaloriesPerKelvin. - /// - public static Entropy? FromCaloriesPerKelvin(QuantityValue? caloriesperkelvin) - { - if (caloriesperkelvin.HasValue) - { - return FromCaloriesPerKelvin(caloriesperkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable JoulesPerDegreeCelsius. - /// - public static Entropy? FromJoulesPerDegreeCelsius(QuantityValue? joulesperdegreecelsius) - { - if (joulesperdegreecelsius.HasValue) - { - return FromJoulesPerDegreeCelsius(joulesperdegreecelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable JoulesPerKelvin. - /// - public static Entropy? FromJoulesPerKelvin(QuantityValue? joulesperkelvin) - { - if (joulesperkelvin.HasValue) - { - return FromJoulesPerKelvin(joulesperkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable KilocaloriesPerKelvin. - /// - public static Entropy? FromKilocaloriesPerKelvin(QuantityValue? kilocaloriesperkelvin) - { - if (kilocaloriesperkelvin.HasValue) - { - return FromKilocaloriesPerKelvin(kilocaloriesperkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable KilojoulesPerDegreeCelsius. - /// - public static Entropy? FromKilojoulesPerDegreeCelsius(QuantityValue? kilojoulesperdegreecelsius) - { - if (kilojoulesperdegreecelsius.HasValue) - { - return FromKilojoulesPerDegreeCelsius(kilojoulesperdegreecelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable KilojoulesPerKelvin. - /// - public static Entropy? FromKilojoulesPerKelvin(QuantityValue? kilojoulesperkelvin) - { - if (kilojoulesperkelvin.HasValue) - { - return FromKilojoulesPerKelvin(kilojoulesperkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Entropy from nullable MegajoulesPerKelvin. - /// - public static Entropy? FromMegajoulesPerKelvin(QuantityValue? megajoulesperkelvin) - { - if (megajoulesperkelvin.HasValue) - { - return FromMegajoulesPerKelvin(megajoulesperkelvin.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -413,25 +305,6 @@ public static Entropy From(QuantityValue value, EntropyUnit fromUnit) return new Entropy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Entropy unit value. - public static Entropy? From(QuantityValue? value, EntropyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Entropy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -474,48 +347,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Entropy operator -(Entropy right) - { - return new Entropy(-right.Value, right.Unit); - } - - public static Entropy operator +(Entropy left, Entropy right) - { - return new Entropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Entropy operator -(Entropy left, Entropy right) - { - return new Entropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Entropy operator *(double left, Entropy right) - { - return new Entropy(left * right.Value, right.Unit); - } - - public static Entropy operator *(Entropy left, double right) - { - return new Entropy(left.Value * right, left.Unit); - } - - public static Entropy operator /(Entropy left, double right) - { - return new Entropy(left.Value / right, left.Unit); - } - - public static double operator /(Entropy left, Entropy right) - { - return left.JoulesPerKelvin / right.JoulesPerKelvin; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -537,43 +368,6 @@ int CompareTo(Entropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Entropy left, Entropy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Entropy left, Entropy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Entropy left, Entropy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Entropy left, Entropy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Entropy left, Entropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Entropy left, Entropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Flow.g.cs b/UnitsNet/GeneratedCode/Quantities/Flow.g.cs index 9c8bf6cdf0..2577f37291 100644 --- a/UnitsNet/GeneratedCode/Quantities/Flow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Flow.g.cs @@ -611,369 +611,6 @@ public static Flow FromUsGallonsPerSecond(QuantityValue usgallonspersecond) return new Flow(value, FlowUnit.UsGallonsPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Flow from nullable CentilitersPerMinute. - /// - public static Flow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) - { - if (centilitersperminute.HasValue) - { - return FromCentilitersPerMinute(centilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicDecimetersPerMinute. - /// - public static Flow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) - { - if (cubicdecimetersperminute.HasValue) - { - return FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicFeetPerHour. - /// - public static Flow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) - { - if (cubicfeetperhour.HasValue) - { - return FromCubicFeetPerHour(cubicfeetperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicFeetPerMinute. - /// - public static Flow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) - { - if (cubicfeetperminute.HasValue) - { - return FromCubicFeetPerMinute(cubicfeetperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicFeetPerSecond. - /// - public static Flow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) - { - if (cubicfeetpersecond.HasValue) - { - return FromCubicFeetPerSecond(cubicfeetpersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicMetersPerHour. - /// - public static Flow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) - { - if (cubicmetersperhour.HasValue) - { - return FromCubicMetersPerHour(cubicmetersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicMetersPerMinute. - /// - public static Flow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) - { - if (cubicmetersperminute.HasValue) - { - return FromCubicMetersPerMinute(cubicmetersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicMetersPerSecond. - /// - public static Flow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) - { - if (cubicmeterspersecond.HasValue) - { - return FromCubicMetersPerSecond(cubicmeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicYardsPerHour. - /// - public static Flow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) - { - if (cubicyardsperhour.HasValue) - { - return FromCubicYardsPerHour(cubicyardsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicYardsPerMinute. - /// - public static Flow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) - { - if (cubicyardsperminute.HasValue) - { - return FromCubicYardsPerMinute(cubicyardsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable CubicYardsPerSecond. - /// - public static Flow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) - { - if (cubicyardspersecond.HasValue) - { - return FromCubicYardsPerSecond(cubicyardspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable DecilitersPerMinute. - /// - public static Flow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) - { - if (decilitersperminute.HasValue) - { - return FromDecilitersPerMinute(decilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable KilolitersPerMinute. - /// - public static Flow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) - { - if (kilolitersperminute.HasValue) - { - return FromKilolitersPerMinute(kilolitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable LitersPerHour. - /// - public static Flow? FromLitersPerHour(QuantityValue? litersperhour) - { - if (litersperhour.HasValue) - { - return FromLitersPerHour(litersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable LitersPerMinute. - /// - public static Flow? FromLitersPerMinute(QuantityValue? litersperminute) - { - if (litersperminute.HasValue) - { - return FromLitersPerMinute(litersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable LitersPerSecond. - /// - public static Flow? FromLitersPerSecond(QuantityValue? literspersecond) - { - if (literspersecond.HasValue) - { - return FromLitersPerSecond(literspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable MicrolitersPerMinute. - /// - public static Flow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) - { - if (microlitersperminute.HasValue) - { - return FromMicrolitersPerMinute(microlitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable MillilitersPerMinute. - /// - public static Flow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) - { - if (millilitersperminute.HasValue) - { - return FromMillilitersPerMinute(millilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable MillionUsGallonsPerDay. - /// - public static Flow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) - { - if (millionusgallonsperday.HasValue) - { - return FromMillionUsGallonsPerDay(millionusgallonsperday.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable NanolitersPerMinute. - /// - public static Flow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) - { - if (nanolitersperminute.HasValue) - { - return FromNanolitersPerMinute(nanolitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable OilBarrelsPerDay. - /// - public static Flow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) - { - if (oilbarrelsperday.HasValue) - { - return FromOilBarrelsPerDay(oilbarrelsperday.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable UsGallonsPerHour. - /// - public static Flow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) - { - if (usgallonsperhour.HasValue) - { - return FromUsGallonsPerHour(usgallonsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable UsGallonsPerMinute. - /// - public static Flow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) - { - if (usgallonsperminute.HasValue) - { - return FromUsGallonsPerMinute(usgallonsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Flow from nullable UsGallonsPerSecond. - /// - public static Flow? FromUsGallonsPerSecond(QuantityValue? usgallonspersecond) - { - if (usgallonspersecond.HasValue) - { - return FromUsGallonsPerSecond(usgallonspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -992,25 +629,6 @@ public static Flow From(QuantityValue value, FlowUnit fromUnit) return new Flow((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Flow unit value. - public static Flow? From(QuantityValue? value, FlowUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Flow((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1053,48 +671,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Flow operator -(Flow right) - { - return new Flow(-right.Value, right.Unit); - } - - public static Flow operator +(Flow left, Flow right) - { - return new Flow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Flow operator -(Flow left, Flow right) - { - return new Flow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Flow operator *(double left, Flow right) - { - return new Flow(left * right.Value, right.Unit); - } - - public static Flow operator *(Flow left, double right) - { - return new Flow(left.Value * right, left.Unit); - } - - public static Flow operator /(Flow left, double right) - { - return new Flow(left.Value / right, left.Unit); - } - - public static double operator /(Flow left, Flow right) - { - return left.CubicMetersPerSecond / right.CubicMetersPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1116,43 +692,6 @@ int CompareTo(Flow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Flow left, Flow right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Flow left, Flow right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Flow left, Flow right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Flow left, Flow right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Flow left, Flow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Flow left, Flow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Force.g.cs b/UnitsNet/GeneratedCode/Quantities/Force.g.cs index 0bc9876143..331a798ca3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Force.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Force.g.cs @@ -341,159 +341,6 @@ public static Force FromTonnesForce(QuantityValue tonnesforce) return new Force(value, ForceUnit.TonneForce); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Force from nullable Decanewtons. - /// - public static Force? FromDecanewtons(QuantityValue? decanewtons) - { - if (decanewtons.HasValue) - { - return FromDecanewtons(decanewtons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable Dyne. - /// - public static Force? FromDyne(QuantityValue? dyne) - { - if (dyne.HasValue) - { - return FromDyne(dyne.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable KilogramsForce. - /// - public static Force? FromKilogramsForce(QuantityValue? kilogramsforce) - { - if (kilogramsforce.HasValue) - { - return FromKilogramsForce(kilogramsforce.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable Kilonewtons. - /// - public static Force? FromKilonewtons(QuantityValue? kilonewtons) - { - if (kilonewtons.HasValue) - { - return FromKilonewtons(kilonewtons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable KiloPonds. - /// - public static Force? FromKiloPonds(QuantityValue? kiloponds) - { - if (kiloponds.HasValue) - { - return FromKiloPonds(kiloponds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable Meganewtons. - /// - public static Force? FromMeganewtons(QuantityValue? meganewtons) - { - if (meganewtons.HasValue) - { - return FromMeganewtons(meganewtons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable Newtons. - /// - public static Force? FromNewtons(QuantityValue? newtons) - { - if (newtons.HasValue) - { - return FromNewtons(newtons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable Poundals. - /// - public static Force? FromPoundals(QuantityValue? poundals) - { - if (poundals.HasValue) - { - return FromPoundals(poundals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable PoundsForce. - /// - public static Force? FromPoundsForce(QuantityValue? poundsforce) - { - if (poundsforce.HasValue) - { - return FromPoundsForce(poundsforce.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Force from nullable TonnesForce. - /// - public static Force? FromTonnesForce(QuantityValue? tonnesforce) - { - if (tonnesforce.HasValue) - { - return FromTonnesForce(tonnesforce.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -512,25 +359,6 @@ public static Force From(QuantityValue value, ForceUnit fromUnit) return new Force((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Force unit value. - public static Force? From(QuantityValue? value, ForceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Force((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -573,48 +401,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Force operator -(Force right) - { - return new Force(-right.Value, right.Unit); - } - - public static Force operator +(Force left, Force right) - { - return new Force(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Force operator -(Force left, Force right) - { - return new Force(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Force operator *(double left, Force right) - { - return new Force(left * right.Value, right.Unit); - } - - public static Force operator *(Force left, double right) - { - return new Force(left.Value * right, left.Unit); - } - - public static Force operator /(Force left, double right) - { - return new Force(left.Value / right, left.Unit); - } - - public static double operator /(Force left, Force right) - { - return left.Newtons / right.Newtons; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -636,43 +422,6 @@ int CompareTo(Force other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Force left, Force right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Force left, Force right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Force left, Force right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Force left, Force right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Force left, Force right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Force left, Force right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs index bba1c249b8..1d0036728d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForceChangeRate.g.cs @@ -359,174 +359,6 @@ public static ForceChangeRate FromNewtonsPerSecond(QuantityValue newtonspersecon return new ForceChangeRate(value, ForceChangeRateUnit.NewtonPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ForceChangeRate from nullable CentinewtonsPerSecond. - /// - public static ForceChangeRate? FromCentinewtonsPerSecond(QuantityValue? centinewtonspersecond) - { - if (centinewtonspersecond.HasValue) - { - return FromCentinewtonsPerSecond(centinewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable DecanewtonsPerMinute. - /// - public static ForceChangeRate? FromDecanewtonsPerMinute(QuantityValue? decanewtonsperminute) - { - if (decanewtonsperminute.HasValue) - { - return FromDecanewtonsPerMinute(decanewtonsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable DecanewtonsPerSecond. - /// - public static ForceChangeRate? FromDecanewtonsPerSecond(QuantityValue? decanewtonspersecond) - { - if (decanewtonspersecond.HasValue) - { - return FromDecanewtonsPerSecond(decanewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable DecinewtonsPerSecond. - /// - public static ForceChangeRate? FromDecinewtonsPerSecond(QuantityValue? decinewtonspersecond) - { - if (decinewtonspersecond.HasValue) - { - return FromDecinewtonsPerSecond(decinewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable KilonewtonsPerMinute. - /// - public static ForceChangeRate? FromKilonewtonsPerMinute(QuantityValue? kilonewtonsperminute) - { - if (kilonewtonsperminute.HasValue) - { - return FromKilonewtonsPerMinute(kilonewtonsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable KilonewtonsPerSecond. - /// - public static ForceChangeRate? FromKilonewtonsPerSecond(QuantityValue? kilonewtonspersecond) - { - if (kilonewtonspersecond.HasValue) - { - return FromKilonewtonsPerSecond(kilonewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable MicronewtonsPerSecond. - /// - public static ForceChangeRate? FromMicronewtonsPerSecond(QuantityValue? micronewtonspersecond) - { - if (micronewtonspersecond.HasValue) - { - return FromMicronewtonsPerSecond(micronewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable MillinewtonsPerSecond. - /// - public static ForceChangeRate? FromMillinewtonsPerSecond(QuantityValue? millinewtonspersecond) - { - if (millinewtonspersecond.HasValue) - { - return FromMillinewtonsPerSecond(millinewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable NanonewtonsPerSecond. - /// - public static ForceChangeRate? FromNanonewtonsPerSecond(QuantityValue? nanonewtonspersecond) - { - if (nanonewtonspersecond.HasValue) - { - return FromNanonewtonsPerSecond(nanonewtonspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable NewtonsPerMinute. - /// - public static ForceChangeRate? FromNewtonsPerMinute(QuantityValue? newtonsperminute) - { - if (newtonsperminute.HasValue) - { - return FromNewtonsPerMinute(newtonsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForceChangeRate from nullable NewtonsPerSecond. - /// - public static ForceChangeRate? FromNewtonsPerSecond(QuantityValue? newtonspersecond) - { - if (newtonspersecond.HasValue) - { - return FromNewtonsPerSecond(newtonspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -545,25 +377,6 @@ public static ForceChangeRate From(QuantityValue value, ForceChangeRateUnit from return new ForceChangeRate((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ForceChangeRate unit value. - public static ForceChangeRate? From(QuantityValue? value, ForceChangeRateUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ForceChangeRate((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -606,48 +419,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ForceChangeRate operator -(ForceChangeRate right) - { - return new ForceChangeRate(-right.Value, right.Unit); - } - - public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) - { - return new ForceChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) - { - return new ForceChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ForceChangeRate operator *(double left, ForceChangeRate right) - { - return new ForceChangeRate(left * right.Value, right.Unit); - } - - public static ForceChangeRate operator *(ForceChangeRate left, double right) - { - return new ForceChangeRate(left.Value * right, left.Unit); - } - - public static ForceChangeRate operator /(ForceChangeRate left, double right) - { - return new ForceChangeRate(left.Value / right, left.Unit); - } - - public static double operator /(ForceChangeRate left, ForceChangeRate right) - { - return left.NewtonsPerSecond / right.NewtonsPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -669,43 +440,6 @@ int CompareTo(ForceChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ForceChangeRate left, ForceChangeRate right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ForceChangeRate left, ForceChangeRate right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ForceChangeRate left, ForceChangeRate right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ForceChangeRate left, ForceChangeRate right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ForceChangeRate left, ForceChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ForceChangeRate left, ForceChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs index 01f27b939d..b592ac95ee 100644 --- a/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ForcePerLength.g.cs @@ -323,144 +323,6 @@ public static ForcePerLength FromNewtonsPerMeter(QuantityValue newtonspermeter) return new ForcePerLength(value, ForcePerLengthUnit.NewtonPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ForcePerLength from nullable CentinewtonsPerMeter. - /// - public static ForcePerLength? FromCentinewtonsPerMeter(QuantityValue? centinewtonspermeter) - { - if (centinewtonspermeter.HasValue) - { - return FromCentinewtonsPerMeter(centinewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable DecinewtonsPerMeter. - /// - public static ForcePerLength? FromDecinewtonsPerMeter(QuantityValue? decinewtonspermeter) - { - if (decinewtonspermeter.HasValue) - { - return FromDecinewtonsPerMeter(decinewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable KilogramsForcePerMeter. - /// - public static ForcePerLength? FromKilogramsForcePerMeter(QuantityValue? kilogramsforcepermeter) - { - if (kilogramsforcepermeter.HasValue) - { - return FromKilogramsForcePerMeter(kilogramsforcepermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable KilonewtonsPerMeter. - /// - public static ForcePerLength? FromKilonewtonsPerMeter(QuantityValue? kilonewtonspermeter) - { - if (kilonewtonspermeter.HasValue) - { - return FromKilonewtonsPerMeter(kilonewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable MeganewtonsPerMeter. - /// - public static ForcePerLength? FromMeganewtonsPerMeter(QuantityValue? meganewtonspermeter) - { - if (meganewtonspermeter.HasValue) - { - return FromMeganewtonsPerMeter(meganewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable MicronewtonsPerMeter. - /// - public static ForcePerLength? FromMicronewtonsPerMeter(QuantityValue? micronewtonspermeter) - { - if (micronewtonspermeter.HasValue) - { - return FromMicronewtonsPerMeter(micronewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable MillinewtonsPerMeter. - /// - public static ForcePerLength? FromMillinewtonsPerMeter(QuantityValue? millinewtonspermeter) - { - if (millinewtonspermeter.HasValue) - { - return FromMillinewtonsPerMeter(millinewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable NanonewtonsPerMeter. - /// - public static ForcePerLength? FromNanonewtonsPerMeter(QuantityValue? nanonewtonspermeter) - { - if (nanonewtonspermeter.HasValue) - { - return FromNanonewtonsPerMeter(nanonewtonspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ForcePerLength from nullable NewtonsPerMeter. - /// - public static ForcePerLength? FromNewtonsPerMeter(QuantityValue? newtonspermeter) - { - if (newtonspermeter.HasValue) - { - return FromNewtonsPerMeter(newtonspermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -479,25 +341,6 @@ public static ForcePerLength From(QuantityValue value, ForcePerLengthUnit fromUn return new ForcePerLength((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ForcePerLength unit value. - public static ForcePerLength? From(QuantityValue? value, ForcePerLengthUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ForcePerLength((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -540,48 +383,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ForcePerLength operator -(ForcePerLength right) - { - return new ForcePerLength(-right.Value, right.Unit); - } - - public static ForcePerLength operator +(ForcePerLength left, ForcePerLength right) - { - return new ForcePerLength(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ForcePerLength operator -(ForcePerLength left, ForcePerLength right) - { - return new ForcePerLength(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ForcePerLength operator *(double left, ForcePerLength right) - { - return new ForcePerLength(left * right.Value, right.Unit); - } - - public static ForcePerLength operator *(ForcePerLength left, double right) - { - return new ForcePerLength(left.Value * right, left.Unit); - } - - public static ForcePerLength operator /(ForcePerLength left, double right) - { - return new ForcePerLength(left.Value / right, left.Unit); - } - - public static double operator /(ForcePerLength left, ForcePerLength right) - { - return left.NewtonsPerMeter / right.NewtonsPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -603,43 +404,6 @@ int CompareTo(ForcePerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ForcePerLength left, ForcePerLength right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ForcePerLength left, ForcePerLength right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ForcePerLength left, ForcePerLength right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ForcePerLength left, ForcePerLength right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ForcePerLength left, ForcePerLength right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ForcePerLength left, ForcePerLength right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs index 9c3bd60f3b..fc5cbe8fe6 100644 --- a/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Frequency.g.cs @@ -305,129 +305,6 @@ public static Frequency FromTerahertz(QuantityValue terahertz) return new Frequency(value, FrequencyUnit.Terahertz); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Frequency from nullable CyclesPerHour. - /// - public static Frequency? FromCyclesPerHour(QuantityValue? cyclesperhour) - { - if (cyclesperhour.HasValue) - { - return FromCyclesPerHour(cyclesperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable CyclesPerMinute. - /// - public static Frequency? FromCyclesPerMinute(QuantityValue? cyclesperminute) - { - if (cyclesperminute.HasValue) - { - return FromCyclesPerMinute(cyclesperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable Gigahertz. - /// - public static Frequency? FromGigahertz(QuantityValue? gigahertz) - { - if (gigahertz.HasValue) - { - return FromGigahertz(gigahertz.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable Hertz. - /// - public static Frequency? FromHertz(QuantityValue? hertz) - { - if (hertz.HasValue) - { - return FromHertz(hertz.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable Kilohertz. - /// - public static Frequency? FromKilohertz(QuantityValue? kilohertz) - { - if (kilohertz.HasValue) - { - return FromKilohertz(kilohertz.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable Megahertz. - /// - public static Frequency? FromMegahertz(QuantityValue? megahertz) - { - if (megahertz.HasValue) - { - return FromMegahertz(megahertz.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable RadiansPerSecond. - /// - public static Frequency? FromRadiansPerSecond(QuantityValue? radianspersecond) - { - if (radianspersecond.HasValue) - { - return FromRadiansPerSecond(radianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Frequency from nullable Terahertz. - /// - public static Frequency? FromTerahertz(QuantityValue? terahertz) - { - if (terahertz.HasValue) - { - return FromTerahertz(terahertz.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static Frequency From(QuantityValue value, FrequencyUnit fromUnit) return new Frequency((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Frequency unit value. - public static Frequency? From(QuantityValue? value, FrequencyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Frequency((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -507,48 +365,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Frequency operator -(Frequency right) - { - return new Frequency(-right.Value, right.Unit); - } - - public static Frequency operator +(Frequency left, Frequency right) - { - return new Frequency(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Frequency operator -(Frequency left, Frequency right) - { - return new Frequency(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Frequency operator *(double left, Frequency right) - { - return new Frequency(left * right.Value, right.Unit); - } - - public static Frequency operator *(Frequency left, double right) - { - return new Frequency(left.Value * right, left.Unit); - } - - public static Frequency operator /(Frequency left, double right) - { - return new Frequency(left.Value / right, left.Unit); - } - - public static double operator /(Frequency left, Frequency right) - { - return left.Hertz / right.Hertz; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -570,43 +386,6 @@ int CompareTo(Frequency other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Frequency left, Frequency right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Frequency left, Frequency right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Frequency left, Frequency right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Frequency left, Frequency right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Frequency left, Frequency right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Frequency left, Frequency right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs index f035000e83..a20d6502c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatFlux.g.cs @@ -449,249 +449,6 @@ public static HeatFlux FromWattsPerSquareMeter(QuantityValue wattspersquaremeter return new HeatFlux(value, HeatFluxUnit.WattPerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable HeatFlux from nullable BtusPerHourSquareFoot. - /// - public static HeatFlux? FromBtusPerHourSquareFoot(QuantityValue? btusperhoursquarefoot) - { - if (btusperhoursquarefoot.HasValue) - { - return FromBtusPerHourSquareFoot(btusperhoursquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable BtusPerMinuteSquareFoot. - /// - public static HeatFlux? FromBtusPerMinuteSquareFoot(QuantityValue? btusperminutesquarefoot) - { - if (btusperminutesquarefoot.HasValue) - { - return FromBtusPerMinuteSquareFoot(btusperminutesquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable BtusPerSecondSquareFoot. - /// - public static HeatFlux? FromBtusPerSecondSquareFoot(QuantityValue? btuspersecondsquarefoot) - { - if (btuspersecondsquarefoot.HasValue) - { - return FromBtusPerSecondSquareFoot(btuspersecondsquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable BtusPerSecondSquareInch. - /// - public static HeatFlux? FromBtusPerSecondSquareInch(QuantityValue? btuspersecondsquareinch) - { - if (btuspersecondsquareinch.HasValue) - { - return FromBtusPerSecondSquareInch(btuspersecondsquareinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable CaloriesPerSecondSquareCentimeter. - /// - public static HeatFlux? FromCaloriesPerSecondSquareCentimeter(QuantityValue? caloriespersecondsquarecentimeter) - { - if (caloriespersecondsquarecentimeter.HasValue) - { - return FromCaloriesPerSecondSquareCentimeter(caloriespersecondsquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable CentiwattsPerSquareMeter. - /// - public static HeatFlux? FromCentiwattsPerSquareMeter(QuantityValue? centiwattspersquaremeter) - { - if (centiwattspersquaremeter.HasValue) - { - return FromCentiwattsPerSquareMeter(centiwattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable DeciwattsPerSquareMeter. - /// - public static HeatFlux? FromDeciwattsPerSquareMeter(QuantityValue? deciwattspersquaremeter) - { - if (deciwattspersquaremeter.HasValue) - { - return FromDeciwattsPerSquareMeter(deciwattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable KilocaloriesPerHourSquareMeter. - /// - public static HeatFlux? FromKilocaloriesPerHourSquareMeter(QuantityValue? kilocaloriesperhoursquaremeter) - { - if (kilocaloriesperhoursquaremeter.HasValue) - { - return FromKilocaloriesPerHourSquareMeter(kilocaloriesperhoursquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable KilocaloriesPerSecondSquareCentimeter. - /// - public static HeatFlux? FromKilocaloriesPerSecondSquareCentimeter(QuantityValue? kilocaloriespersecondsquarecentimeter) - { - if (kilocaloriespersecondsquarecentimeter.HasValue) - { - return FromKilocaloriesPerSecondSquareCentimeter(kilocaloriespersecondsquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable KilowattsPerSquareMeter. - /// - public static HeatFlux? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) - { - if (kilowattspersquaremeter.HasValue) - { - return FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable MicrowattsPerSquareMeter. - /// - public static HeatFlux? FromMicrowattsPerSquareMeter(QuantityValue? microwattspersquaremeter) - { - if (microwattspersquaremeter.HasValue) - { - return FromMicrowattsPerSquareMeter(microwattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable MilliwattsPerSquareMeter. - /// - public static HeatFlux? FromMilliwattsPerSquareMeter(QuantityValue? milliwattspersquaremeter) - { - if (milliwattspersquaremeter.HasValue) - { - return FromMilliwattsPerSquareMeter(milliwattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable NanowattsPerSquareMeter. - /// - public static HeatFlux? FromNanowattsPerSquareMeter(QuantityValue? nanowattspersquaremeter) - { - if (nanowattspersquaremeter.HasValue) - { - return FromNanowattsPerSquareMeter(nanowattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareFoot. - /// - public static HeatFlux? FromWattsPerSquareFoot(QuantityValue? wattspersquarefoot) - { - if (wattspersquarefoot.HasValue) - { - return FromWattsPerSquareFoot(wattspersquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareInch. - /// - public static HeatFlux? FromWattsPerSquareInch(QuantityValue? wattspersquareinch) - { - if (wattspersquareinch.HasValue) - { - return FromWattsPerSquareInch(wattspersquareinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatFlux from nullable WattsPerSquareMeter. - /// - public static HeatFlux? FromWattsPerSquareMeter(QuantityValue? wattspersquaremeter) - { - if (wattspersquaremeter.HasValue) - { - return FromWattsPerSquareMeter(wattspersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -710,25 +467,6 @@ public static HeatFlux From(QuantityValue value, HeatFluxUnit fromUnit) return new HeatFlux((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// HeatFlux unit value. - public static HeatFlux? From(QuantityValue? value, HeatFluxUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new HeatFlux((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -771,48 +509,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static HeatFlux operator -(HeatFlux right) - { - return new HeatFlux(-right.Value, right.Unit); - } - - public static HeatFlux operator +(HeatFlux left, HeatFlux right) - { - return new HeatFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static HeatFlux operator -(HeatFlux left, HeatFlux right) - { - return new HeatFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static HeatFlux operator *(double left, HeatFlux right) - { - return new HeatFlux(left * right.Value, right.Unit); - } - - public static HeatFlux operator *(HeatFlux left, double right) - { - return new HeatFlux(left.Value * right, left.Unit); - } - - public static HeatFlux operator /(HeatFlux left, double right) - { - return new HeatFlux(left.Value / right, left.Unit); - } - - public static double operator /(HeatFlux left, HeatFlux right) - { - return left.WattsPerSquareMeter / right.WattsPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -834,43 +530,6 @@ int CompareTo(HeatFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(HeatFlux left, HeatFlux right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(HeatFlux left, HeatFlux right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(HeatFlux left, HeatFlux right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(HeatFlux left, HeatFlux right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(HeatFlux left, HeatFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(HeatFlux left, HeatFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs index 9758064f1d..f88b3e29a5 100644 --- a/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/HeatTransferCoefficient.g.cs @@ -197,39 +197,6 @@ public static HeatTransferCoefficient FromWattsPerSquareMeterKelvin(QuantityValu return new HeatTransferCoefficient(value, HeatTransferCoefficientUnit.WattPerSquareMeterKelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterCelsius. - /// - public static HeatTransferCoefficient? FromWattsPerSquareMeterCelsius(QuantityValue? wattspersquaremetercelsius) - { - if (wattspersquaremetercelsius.HasValue) - { - return FromWattsPerSquareMeterCelsius(wattspersquaremetercelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterKelvin. - /// - public static HeatTransferCoefficient? FromWattsPerSquareMeterKelvin(QuantityValue? wattspersquaremeterkelvin) - { - if (wattspersquaremeterkelvin.HasValue) - { - return FromWattsPerSquareMeterKelvin(wattspersquaremeterkelvin.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -248,25 +215,6 @@ public static HeatTransferCoefficient From(QuantityValue value, HeatTransferCoef return new HeatTransferCoefficient((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// HeatTransferCoefficient unit value. - public static HeatTransferCoefficient? From(QuantityValue? value, HeatTransferCoefficientUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new HeatTransferCoefficient((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -309,48 +257,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static HeatTransferCoefficient operator -(HeatTransferCoefficient right) - { - return new HeatTransferCoefficient(-right.Value, right.Unit); - } - - public static HeatTransferCoefficient operator +(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return new HeatTransferCoefficient(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static HeatTransferCoefficient operator -(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return new HeatTransferCoefficient(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static HeatTransferCoefficient operator *(double left, HeatTransferCoefficient right) - { - return new HeatTransferCoefficient(left * right.Value, right.Unit); - } - - public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, double right) - { - return new HeatTransferCoefficient(left.Value * right, left.Unit); - } - - public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, double right) - { - return new HeatTransferCoefficient(left.Value / right, left.Unit); - } - - public static double operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return left.WattsPerSquareMeterKelvin / right.WattsPerSquareMeterKelvin; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -372,43 +278,6 @@ int CompareTo(HeatTransferCoefficient other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(HeatTransferCoefficient left, HeatTransferCoefficient right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs index 5648946221..1344071916 100644 --- a/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Illuminance.g.cs @@ -233,69 +233,6 @@ public static Illuminance FromMillilux(QuantityValue millilux) return new Illuminance(value, IlluminanceUnit.Millilux); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Illuminance from nullable Kilolux. - /// - public static Illuminance? FromKilolux(QuantityValue? kilolux) - { - if (kilolux.HasValue) - { - return FromKilolux(kilolux.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Illuminance from nullable Lux. - /// - public static Illuminance? FromLux(QuantityValue? lux) - { - if (lux.HasValue) - { - return FromLux(lux.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Illuminance from nullable Megalux. - /// - public static Illuminance? FromMegalux(QuantityValue? megalux) - { - if (megalux.HasValue) - { - return FromMegalux(megalux.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Illuminance from nullable Millilux. - /// - public static Illuminance? FromMillilux(QuantityValue? millilux) - { - if (millilux.HasValue) - { - return FromMillilux(millilux.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static Illuminance From(QuantityValue value, IlluminanceUnit fromUnit) return new Illuminance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Illuminance unit value. - public static Illuminance? From(QuantityValue? value, IlluminanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Illuminance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Illuminance operator -(Illuminance right) - { - return new Illuminance(-right.Value, right.Unit); - } - - public static Illuminance operator +(Illuminance left, Illuminance right) - { - return new Illuminance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Illuminance operator -(Illuminance left, Illuminance right) - { - return new Illuminance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Illuminance operator *(double left, Illuminance right) - { - return new Illuminance(left * right.Value, right.Unit); - } - - public static Illuminance operator *(Illuminance left, double right) - { - return new Illuminance(left.Value * right, left.Unit); - } - - public static Illuminance operator /(Illuminance left, double right) - { - return new Illuminance(left.Value / right, left.Unit); - } - - public static double operator /(Illuminance left, Illuminance right) - { - return left.Lux / right.Lux; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(Illuminance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Illuminance left, Illuminance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Illuminance left, Illuminance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Illuminance left, Illuminance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Illuminance left, Illuminance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Illuminance left, Illuminance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Illuminance left, Illuminance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Information.g.cs b/UnitsNet/GeneratedCode/Quantities/Information.g.cs index 9ec8164943..6e07594e0e 100644 --- a/UnitsNet/GeneratedCode/Quantities/Information.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Information.g.cs @@ -619,399 +619,6 @@ public static Information FromTerabytes(QuantityValue terabytes) return new Information(value, InformationUnit.Terabyte); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Information from nullable Bits. - /// - public static Information? FromBits(QuantityValue? bits) - { - if (bits.HasValue) - { - return FromBits(bits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Bytes. - /// - public static Information? FromBytes(QuantityValue? bytes) - { - if (bytes.HasValue) - { - return FromBytes(bytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Exabits. - /// - public static Information? FromExabits(QuantityValue? exabits) - { - if (exabits.HasValue) - { - return FromExabits(exabits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Exabytes. - /// - public static Information? FromExabytes(QuantityValue? exabytes) - { - if (exabytes.HasValue) - { - return FromExabytes(exabytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Exbibits. - /// - public static Information? FromExbibits(QuantityValue? exbibits) - { - if (exbibits.HasValue) - { - return FromExbibits(exbibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Exbibytes. - /// - public static Information? FromExbibytes(QuantityValue? exbibytes) - { - if (exbibytes.HasValue) - { - return FromExbibytes(exbibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Gibibits. - /// - public static Information? FromGibibits(QuantityValue? gibibits) - { - if (gibibits.HasValue) - { - return FromGibibits(gibibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Gibibytes. - /// - public static Information? FromGibibytes(QuantityValue? gibibytes) - { - if (gibibytes.HasValue) - { - return FromGibibytes(gibibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Gigabits. - /// - public static Information? FromGigabits(QuantityValue? gigabits) - { - if (gigabits.HasValue) - { - return FromGigabits(gigabits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Gigabytes. - /// - public static Information? FromGigabytes(QuantityValue? gigabytes) - { - if (gigabytes.HasValue) - { - return FromGigabytes(gigabytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Kibibits. - /// - public static Information? FromKibibits(QuantityValue? kibibits) - { - if (kibibits.HasValue) - { - return FromKibibits(kibibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Kibibytes. - /// - public static Information? FromKibibytes(QuantityValue? kibibytes) - { - if (kibibytes.HasValue) - { - return FromKibibytes(kibibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Kilobits. - /// - public static Information? FromKilobits(QuantityValue? kilobits) - { - if (kilobits.HasValue) - { - return FromKilobits(kilobits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Kilobytes. - /// - public static Information? FromKilobytes(QuantityValue? kilobytes) - { - if (kilobytes.HasValue) - { - return FromKilobytes(kilobytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Mebibits. - /// - public static Information? FromMebibits(QuantityValue? mebibits) - { - if (mebibits.HasValue) - { - return FromMebibits(mebibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Mebibytes. - /// - public static Information? FromMebibytes(QuantityValue? mebibytes) - { - if (mebibytes.HasValue) - { - return FromMebibytes(mebibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Megabits. - /// - public static Information? FromMegabits(QuantityValue? megabits) - { - if (megabits.HasValue) - { - return FromMegabits(megabits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Megabytes. - /// - public static Information? FromMegabytes(QuantityValue? megabytes) - { - if (megabytes.HasValue) - { - return FromMegabytes(megabytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Pebibits. - /// - public static Information? FromPebibits(QuantityValue? pebibits) - { - if (pebibits.HasValue) - { - return FromPebibits(pebibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Pebibytes. - /// - public static Information? FromPebibytes(QuantityValue? pebibytes) - { - if (pebibytes.HasValue) - { - return FromPebibytes(pebibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Petabits. - /// - public static Information? FromPetabits(QuantityValue? petabits) - { - if (petabits.HasValue) - { - return FromPetabits(petabits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Petabytes. - /// - public static Information? FromPetabytes(QuantityValue? petabytes) - { - if (petabytes.HasValue) - { - return FromPetabytes(petabytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Tebibits. - /// - public static Information? FromTebibits(QuantityValue? tebibits) - { - if (tebibits.HasValue) - { - return FromTebibits(tebibits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Tebibytes. - /// - public static Information? FromTebibytes(QuantityValue? tebibytes) - { - if (tebibytes.HasValue) - { - return FromTebibytes(tebibytes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Terabits. - /// - public static Information? FromTerabits(QuantityValue? terabits) - { - if (terabits.HasValue) - { - return FromTerabits(terabits.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Information from nullable Terabytes. - /// - public static Information? FromTerabytes(QuantityValue? terabytes) - { - if (terabytes.HasValue) - { - return FromTerabytes(terabytes.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1030,25 +637,6 @@ public static Information From(QuantityValue value, InformationUnit fromUnit) return new Information((decimal)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Information unit value. - public static Information? From(QuantityValue? value, InformationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Information((decimal)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1091,48 +679,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Information operator -(Information right) - { - return new Information(-right.Value, right.Unit); - } - - public static Information operator +(Information left, Information right) - { - return new Information(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Information operator -(Information left, Information right) - { - return new Information(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Information operator *(decimal left, Information right) - { - return new Information(left * right.Value, right.Unit); - } - - public static Information operator *(Information left, decimal right) - { - return new Information(left.Value * right, left.Unit); - } - - public static Information operator /(Information left, decimal right) - { - return new Information(left.Value / right, left.Unit); - } - - public static double operator /(Information left, Information right) - { - return left.Bits / right.Bits; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1154,41 +700,6 @@ int CompareTo(Information other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Information left, Information right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Information left, Information right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Information left, Information right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Information left, Information right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - public static bool operator ==(Information left, Information right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - public static bool operator !=(Information left, Information right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - public override bool Equals(object obj) { if(obj is null || !(obj is Information)) diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs index 8b0e630380..6db37977c3 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiance.g.cs @@ -197,39 +197,6 @@ public static Irradiance FromWattsPerSquareMeter(QuantityValue wattspersquaremet return new Irradiance(value, IrradianceUnit.WattPerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Irradiance from nullable KilowattsPerSquareMeter. - /// - public static Irradiance? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) - { - if (kilowattspersquaremeter.HasValue) - { - return FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Irradiance from nullable WattsPerSquareMeter. - /// - public static Irradiance? FromWattsPerSquareMeter(QuantityValue? wattspersquaremeter) - { - if (wattspersquaremeter.HasValue) - { - return FromWattsPerSquareMeter(wattspersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -248,25 +215,6 @@ public static Irradiance From(QuantityValue value, IrradianceUnit fromUnit) return new Irradiance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Irradiance unit value. - public static Irradiance? From(QuantityValue? value, IrradianceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Irradiance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -309,48 +257,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Irradiance operator -(Irradiance right) - { - return new Irradiance(-right.Value, right.Unit); - } - - public static Irradiance operator +(Irradiance left, Irradiance right) - { - return new Irradiance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Irradiance operator -(Irradiance left, Irradiance right) - { - return new Irradiance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Irradiance operator *(double left, Irradiance right) - { - return new Irradiance(left * right.Value, right.Unit); - } - - public static Irradiance operator *(Irradiance left, double right) - { - return new Irradiance(left.Value * right, left.Unit); - } - - public static Irradiance operator /(Irradiance left, double right) - { - return new Irradiance(left.Value / right, left.Unit); - } - - public static double operator /(Irradiance left, Irradiance right) - { - return left.WattsPerSquareMeter / right.WattsPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -372,43 +278,6 @@ int CompareTo(Irradiance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Irradiance left, Irradiance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Irradiance left, Irradiance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Irradiance left, Irradiance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Irradiance left, Irradiance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Irradiance left, Irradiance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Irradiance left, Irradiance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs index bd61be9a2c..7545e2b3a2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Irradiation.g.cs @@ -215,54 +215,6 @@ public static Irradiation FromWattHoursPerSquareMeter(QuantityValue watthoursper return new Irradiation(value, IrradiationUnit.WattHourPerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Irradiation from nullable JoulesPerSquareMeter. - /// - public static Irradiation? FromJoulesPerSquareMeter(QuantityValue? joulespersquaremeter) - { - if (joulespersquaremeter.HasValue) - { - return FromJoulesPerSquareMeter(joulespersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Irradiation from nullable KilowattHoursPerSquareMeter. - /// - public static Irradiation? FromKilowattHoursPerSquareMeter(QuantityValue? kilowatthourspersquaremeter) - { - if (kilowatthourspersquaremeter.HasValue) - { - return FromKilowattHoursPerSquareMeter(kilowatthourspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Irradiation from nullable WattHoursPerSquareMeter. - /// - public static Irradiation? FromWattHoursPerSquareMeter(QuantityValue? watthourspersquaremeter) - { - if (watthourspersquaremeter.HasValue) - { - return FromWattHoursPerSquareMeter(watthourspersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static Irradiation From(QuantityValue value, IrradiationUnit fromUnit) return new Irradiation((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Irradiation unit value. - public static Irradiation? From(QuantityValue? value, IrradiationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Irradiation((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Irradiation operator -(Irradiation right) - { - return new Irradiation(-right.Value, right.Unit); - } - - public static Irradiation operator +(Irradiation left, Irradiation right) - { - return new Irradiation(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Irradiation operator -(Irradiation left, Irradiation right) - { - return new Irradiation(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Irradiation operator *(double left, Irradiation right) - { - return new Irradiation(left * right.Value, right.Unit); - } - - public static Irradiation operator *(Irradiation left, double right) - { - return new Irradiation(left.Value * right, left.Unit); - } - - public static Irradiation operator /(Irradiation left, double right) - { - return new Irradiation(left.Value / right, left.Unit); - } - - public static double operator /(Irradiation left, Irradiation right) - { - return left.JoulesPerSquareMeter / right.JoulesPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(Irradiation other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Irradiation left, Irradiation right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Irradiation left, Irradiation right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Irradiation left, Irradiation right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Irradiation left, Irradiation right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Irradiation left, Irradiation right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Irradiation left, Irradiation right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs index b27b7b6e75..3d00239f2d 100644 --- a/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/KinematicViscosity.g.cs @@ -305,129 +305,6 @@ public static KinematicViscosity FromStokes(QuantityValue stokes) return new KinematicViscosity(value, KinematicViscosityUnit.Stokes); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable KinematicViscosity from nullable Centistokes. - /// - public static KinematicViscosity? FromCentistokes(QuantityValue? centistokes) - { - if (centistokes.HasValue) - { - return FromCentistokes(centistokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Decistokes. - /// - public static KinematicViscosity? FromDecistokes(QuantityValue? decistokes) - { - if (decistokes.HasValue) - { - return FromDecistokes(decistokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Kilostokes. - /// - public static KinematicViscosity? FromKilostokes(QuantityValue? kilostokes) - { - if (kilostokes.HasValue) - { - return FromKilostokes(kilostokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Microstokes. - /// - public static KinematicViscosity? FromMicrostokes(QuantityValue? microstokes) - { - if (microstokes.HasValue) - { - return FromMicrostokes(microstokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Millistokes. - /// - public static KinematicViscosity? FromMillistokes(QuantityValue? millistokes) - { - if (millistokes.HasValue) - { - return FromMillistokes(millistokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Nanostokes. - /// - public static KinematicViscosity? FromNanostokes(QuantityValue? nanostokes) - { - if (nanostokes.HasValue) - { - return FromNanostokes(nanostokes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable SquareMetersPerSecond. - /// - public static KinematicViscosity? FromSquareMetersPerSecond(QuantityValue? squaremeterspersecond) - { - if (squaremeterspersecond.HasValue) - { - return FromSquareMetersPerSecond(squaremeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable KinematicViscosity from nullable Stokes. - /// - public static KinematicViscosity? FromStokes(QuantityValue? stokes) - { - if (stokes.HasValue) - { - return FromStokes(stokes.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static KinematicViscosity From(QuantityValue value, KinematicViscosityUni return new KinematicViscosity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// KinematicViscosity unit value. - public static KinematicViscosity? From(QuantityValue? value, KinematicViscosityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new KinematicViscosity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -507,48 +365,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static KinematicViscosity operator -(KinematicViscosity right) - { - return new KinematicViscosity(-right.Value, right.Unit); - } - - public static KinematicViscosity operator +(KinematicViscosity left, KinematicViscosity right) - { - return new KinematicViscosity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static KinematicViscosity operator -(KinematicViscosity left, KinematicViscosity right) - { - return new KinematicViscosity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static KinematicViscosity operator *(double left, KinematicViscosity right) - { - return new KinematicViscosity(left * right.Value, right.Unit); - } - - public static KinematicViscosity operator *(KinematicViscosity left, double right) - { - return new KinematicViscosity(left.Value * right, left.Unit); - } - - public static KinematicViscosity operator /(KinematicViscosity left, double right) - { - return new KinematicViscosity(left.Value / right, left.Unit); - } - - public static double operator /(KinematicViscosity left, KinematicViscosity right) - { - return left.SquareMetersPerSecond / right.SquareMetersPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -570,43 +386,6 @@ int CompareTo(KinematicViscosity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(KinematicViscosity left, KinematicViscosity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(KinematicViscosity left, KinematicViscosity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(KinematicViscosity left, KinematicViscosity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(KinematicViscosity left, KinematicViscosity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(KinematicViscosity left, KinematicViscosity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(KinematicViscosity left, KinematicViscosity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs index 571a4d31fc..ea0d1d7b49 100644 --- a/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LapseRate.g.cs @@ -179,24 +179,6 @@ public static LapseRate FromDegreesCelciusPerKilometer(QuantityValue degreescelc return new LapseRate(value, LapseRateUnit.DegreeCelsiusPerKilometer); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable LapseRate from nullable DegreesCelciusPerKilometer. - /// - public static LapseRate? FromDegreesCelciusPerKilometer(QuantityValue? degreescelciusperkilometer) - { - if (degreescelciusperkilometer.HasValue) - { - return FromDegreesCelciusPerKilometer(degreescelciusperkilometer.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static LapseRate From(QuantityValue value, LapseRateUnit fromUnit) return new LapseRate((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LapseRate unit value. - public static LapseRate? From(QuantityValue? value, LapseRateUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new LapseRate((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static LapseRate operator -(LapseRate right) - { - return new LapseRate(-right.Value, right.Unit); - } - - public static LapseRate operator +(LapseRate left, LapseRate right) - { - return new LapseRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LapseRate operator -(LapseRate left, LapseRate right) - { - return new LapseRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LapseRate operator *(double left, LapseRate right) - { - return new LapseRate(left * right.Value, right.Unit); - } - - public static LapseRate operator *(LapseRate left, double right) - { - return new LapseRate(left.Value * right, left.Unit); - } - - public static LapseRate operator /(LapseRate left, double right) - { - return new LapseRate(left.Value / right, left.Unit); - } - - public static double operator /(LapseRate left, LapseRate right) - { - return left.DegreesCelciusPerKilometer / right.DegreesCelciusPerKilometer; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(LapseRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(LapseRate left, LapseRate right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(LapseRate left, LapseRate right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(LapseRate left, LapseRate right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(LapseRate left, LapseRate right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(LapseRate left, LapseRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(LapseRate left, LapseRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Length.g.cs b/UnitsNet/GeneratedCode/Quantities/Length.g.cs index f39fbffa12..20512d3caf 100644 --- a/UnitsNet/GeneratedCode/Quantities/Length.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Length.g.cs @@ -557,339 +557,6 @@ public static Length FromYards(QuantityValue yards) return new Length(value, LengthUnit.Yard); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Length from nullable Centimeters. - /// - public static Length? FromCentimeters(QuantityValue? centimeters) - { - if (centimeters.HasValue) - { - return FromCentimeters(centimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Decimeters. - /// - public static Length? FromDecimeters(QuantityValue? decimeters) - { - if (decimeters.HasValue) - { - return FromDecimeters(decimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable DtpPicas. - /// - public static Length? FromDtpPicas(QuantityValue? dtppicas) - { - if (dtppicas.HasValue) - { - return FromDtpPicas(dtppicas.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable DtpPoints. - /// - public static Length? FromDtpPoints(QuantityValue? dtppoints) - { - if (dtppoints.HasValue) - { - return FromDtpPoints(dtppoints.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Fathoms. - /// - public static Length? FromFathoms(QuantityValue? fathoms) - { - if (fathoms.HasValue) - { - return FromFathoms(fathoms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Feet. - /// - public static Length? FromFeet(QuantityValue? feet) - { - if (feet.HasValue) - { - return FromFeet(feet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Inches. - /// - public static Length? FromInches(QuantityValue? inches) - { - if (inches.HasValue) - { - return FromInches(inches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Kilometers. - /// - public static Length? FromKilometers(QuantityValue? kilometers) - { - if (kilometers.HasValue) - { - return FromKilometers(kilometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Meters. - /// - public static Length? FromMeters(QuantityValue? meters) - { - if (meters.HasValue) - { - return FromMeters(meters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Microinches. - /// - public static Length? FromMicroinches(QuantityValue? microinches) - { - if (microinches.HasValue) - { - return FromMicroinches(microinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Micrometers. - /// - public static Length? FromMicrometers(QuantityValue? micrometers) - { - if (micrometers.HasValue) - { - return FromMicrometers(micrometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Mils. - /// - public static Length? FromMils(QuantityValue? mils) - { - if (mils.HasValue) - { - return FromMils(mils.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Miles. - /// - public static Length? FromMiles(QuantityValue? miles) - { - if (miles.HasValue) - { - return FromMiles(miles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Millimeters. - /// - public static Length? FromMillimeters(QuantityValue? millimeters) - { - if (millimeters.HasValue) - { - return FromMillimeters(millimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Nanometers. - /// - public static Length? FromNanometers(QuantityValue? nanometers) - { - if (nanometers.HasValue) - { - return FromNanometers(nanometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable NauticalMiles. - /// - public static Length? FromNauticalMiles(QuantityValue? nauticalmiles) - { - if (nauticalmiles.HasValue) - { - return FromNauticalMiles(nauticalmiles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable PrinterPicas. - /// - public static Length? FromPrinterPicas(QuantityValue? printerpicas) - { - if (printerpicas.HasValue) - { - return FromPrinterPicas(printerpicas.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable PrinterPoints. - /// - public static Length? FromPrinterPoints(QuantityValue? printerpoints) - { - if (printerpoints.HasValue) - { - return FromPrinterPoints(printerpoints.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Shackles. - /// - public static Length? FromShackles(QuantityValue? shackles) - { - if (shackles.HasValue) - { - return FromShackles(shackles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Twips. - /// - public static Length? FromTwips(QuantityValue? twips) - { - if (twips.HasValue) - { - return FromTwips(twips.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable UsSurveyFeet. - /// - public static Length? FromUsSurveyFeet(QuantityValue? ussurveyfeet) - { - if (ussurveyfeet.HasValue) - { - return FromUsSurveyFeet(ussurveyfeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Length from nullable Yards. - /// - public static Length? FromYards(QuantityValue? yards) - { - if (yards.HasValue) - { - return FromYards(yards.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -908,25 +575,6 @@ public static Length From(QuantityValue value, LengthUnit fromUnit) return new Length((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Length unit value. - public static Length? From(QuantityValue? value, LengthUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Length((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -969,48 +617,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Length operator -(Length right) - { - return new Length(-right.Value, right.Unit); - } - - public static Length operator +(Length left, Length right) - { - return new Length(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Length operator -(Length left, Length right) - { - return new Length(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Length operator *(double left, Length right) - { - return new Length(left * right.Value, right.Unit); - } - - public static Length operator *(Length left, double right) - { - return new Length(left.Value * right, left.Unit); - } - - public static Length operator /(Length left, double right) - { - return new Length(left.Value / right, left.Unit); - } - - public static double operator /(Length left, Length right) - { - return left.Meters / right.Meters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1032,43 +638,6 @@ int CompareTo(Length other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Length left, Length right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Length left, Length right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Length left, Length right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Length left, Length right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Length left, Length right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Length left, Length right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Level.g.cs b/UnitsNet/GeneratedCode/Quantities/Level.g.cs index 4a09b9810d..64010d37d9 100644 --- a/UnitsNet/GeneratedCode/Quantities/Level.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Level.g.cs @@ -187,39 +187,6 @@ public static Level FromNepers(QuantityValue nepers) return new Level(value, LevelUnit.Neper); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Level from nullable Decibels. - /// - public static Level? FromDecibels(QuantityValue? decibels) - { - if (decibels.HasValue) - { - return FromDecibels(decibels.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Level from nullable Nepers. - /// - public static Level? FromNepers(QuantityValue? nepers) - { - if (nepers.HasValue) - { - return FromNepers(nepers.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -238,25 +205,6 @@ public static Level From(QuantityValue value, LevelUnit fromUnit) return new Level((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Level unit value. - public static Level? From(QuantityValue? value, LevelUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Level((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -299,56 +247,6 @@ public static string GetAbbreviation( #endregion - #region Logarithmic Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Level operator -(Level right) - { - return new Level(-right.Value, right.Unit); - } - - public static Level operator +(Level left, Level right) - { - // Logarithmic addition - // Formula: 10*log10(10^(x/10) + 10^(y/10)) - return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); - } - - public static Level operator -(Level left, Level right) - { - // Logarithmic subtraction - // Formula: 10*log10(10^(x/10) - 10^(y/10)) - return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); - } - - public static Level operator *(double left, Level right) - { - // Logarithmic multiplication = addition - return new Level(left + right.Value, right.Unit); - } - - public static Level operator *(Level left, double right) - { - // Logarithmic multiplication = addition - return new Level(left.Value + (double)right, left.Unit); - } - - public static Level operator /(Level left, double right) - { - // Logarithmic division = subtraction - return new Level(left.Value - (double)right, left.Unit); - } - - public static double operator /(Level left, Level right) - { - // Logarithmic division = subtraction - return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -370,43 +268,6 @@ int CompareTo(Level other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Level left, Level right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Level left, Level right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Level left, Level right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Level left, Level right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Level left, Level right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Level left, Level right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs index 7deae00ea3..5928d01bdf 100644 --- a/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LinearDensity.g.cs @@ -215,54 +215,6 @@ public static LinearDensity FromPoundsPerFoot(QuantityValue poundsperfoot) return new LinearDensity(value, LinearDensityUnit.PoundPerFoot); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable LinearDensity from nullable GramsPerMeter. - /// - public static LinearDensity? FromGramsPerMeter(QuantityValue? gramspermeter) - { - if (gramspermeter.HasValue) - { - return FromGramsPerMeter(gramspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable LinearDensity from nullable KilogramsPerMeter. - /// - public static LinearDensity? FromKilogramsPerMeter(QuantityValue? kilogramspermeter) - { - if (kilogramspermeter.HasValue) - { - return FromKilogramsPerMeter(kilogramspermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable LinearDensity from nullable PoundsPerFoot. - /// - public static LinearDensity? FromPoundsPerFoot(QuantityValue? poundsperfoot) - { - if (poundsperfoot.HasValue) - { - return FromPoundsPerFoot(poundsperfoot.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static LinearDensity From(QuantityValue value, LinearDensityUnit fromUnit return new LinearDensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LinearDensity unit value. - public static LinearDensity? From(QuantityValue? value, LinearDensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new LinearDensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static LinearDensity operator -(LinearDensity right) - { - return new LinearDensity(-right.Value, right.Unit); - } - - public static LinearDensity operator +(LinearDensity left, LinearDensity right) - { - return new LinearDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LinearDensity operator -(LinearDensity left, LinearDensity right) - { - return new LinearDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LinearDensity operator *(double left, LinearDensity right) - { - return new LinearDensity(left * right.Value, right.Unit); - } - - public static LinearDensity operator *(LinearDensity left, double right) - { - return new LinearDensity(left.Value * right, left.Unit); - } - - public static LinearDensity operator /(LinearDensity left, double right) - { - return new LinearDensity(left.Value / right, left.Unit); - } - - public static double operator /(LinearDensity left, LinearDensity right) - { - return left.KilogramsPerMeter / right.KilogramsPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(LinearDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(LinearDensity left, LinearDensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(LinearDensity left, LinearDensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(LinearDensity left, LinearDensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(LinearDensity left, LinearDensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(LinearDensity left, LinearDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(LinearDensity left, LinearDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs index 718444cb10..aa5bf83904 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousFlux.g.cs @@ -179,24 +179,6 @@ public static LuminousFlux FromLumens(QuantityValue lumens) return new LuminousFlux(value, LuminousFluxUnit.Lumen); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable LuminousFlux from nullable Lumens. - /// - public static LuminousFlux? FromLumens(QuantityValue? lumens) - { - if (lumens.HasValue) - { - return FromLumens(lumens.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static LuminousFlux From(QuantityValue value, LuminousFluxUnit fromUnit) return new LuminousFlux((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LuminousFlux unit value. - public static LuminousFlux? From(QuantityValue? value, LuminousFluxUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new LuminousFlux((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static LuminousFlux operator -(LuminousFlux right) - { - return new LuminousFlux(-right.Value, right.Unit); - } - - public static LuminousFlux operator +(LuminousFlux left, LuminousFlux right) - { - return new LuminousFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LuminousFlux operator -(LuminousFlux left, LuminousFlux right) - { - return new LuminousFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LuminousFlux operator *(double left, LuminousFlux right) - { - return new LuminousFlux(left * right.Value, right.Unit); - } - - public static LuminousFlux operator *(LuminousFlux left, double right) - { - return new LuminousFlux(left.Value * right, left.Unit); - } - - public static LuminousFlux operator /(LuminousFlux left, double right) - { - return new LuminousFlux(left.Value / right, left.Unit); - } - - public static double operator /(LuminousFlux left, LuminousFlux right) - { - return left.Lumens / right.Lumens; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(LuminousFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(LuminousFlux left, LuminousFlux right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(LuminousFlux left, LuminousFlux right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(LuminousFlux left, LuminousFlux right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(LuminousFlux left, LuminousFlux right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(LuminousFlux left, LuminousFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(LuminousFlux left, LuminousFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs index f03387900e..1c923ba3ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/LuminousIntensity.g.cs @@ -179,24 +179,6 @@ public static LuminousIntensity FromCandela(QuantityValue candela) return new LuminousIntensity(value, LuminousIntensityUnit.Candela); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable LuminousIntensity from nullable Candela. - /// - public static LuminousIntensity? FromCandela(QuantityValue? candela) - { - if (candela.HasValue) - { - return FromCandela(candela.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static LuminousIntensity From(QuantityValue value, LuminousIntensityUnit return new LuminousIntensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// LuminousIntensity unit value. - public static LuminousIntensity? From(QuantityValue? value, LuminousIntensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new LuminousIntensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static LuminousIntensity operator -(LuminousIntensity right) - { - return new LuminousIntensity(-right.Value, right.Unit); - } - - public static LuminousIntensity operator +(LuminousIntensity left, LuminousIntensity right) - { - return new LuminousIntensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LuminousIntensity operator -(LuminousIntensity left, LuminousIntensity right) - { - return new LuminousIntensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static LuminousIntensity operator *(double left, LuminousIntensity right) - { - return new LuminousIntensity(left * right.Value, right.Unit); - } - - public static LuminousIntensity operator *(LuminousIntensity left, double right) - { - return new LuminousIntensity(left.Value * right, left.Unit); - } - - public static LuminousIntensity operator /(LuminousIntensity left, double right) - { - return new LuminousIntensity(left.Value / right, left.Unit); - } - - public static double operator /(LuminousIntensity left, LuminousIntensity right) - { - return left.Candela / right.Candela; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(LuminousIntensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(LuminousIntensity left, LuminousIntensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(LuminousIntensity left, LuminousIntensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(LuminousIntensity left, LuminousIntensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(LuminousIntensity left, LuminousIntensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(LuminousIntensity left, LuminousIntensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(LuminousIntensity left, LuminousIntensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs index 2a00c13d0c..7835f52161 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticField.g.cs @@ -179,24 +179,6 @@ public static MagneticField FromTeslas(QuantityValue teslas) return new MagneticField(value, MagneticFieldUnit.Tesla); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MagneticField from nullable Teslas. - /// - public static MagneticField? FromTeslas(QuantityValue? teslas) - { - if (teslas.HasValue) - { - return FromTeslas(teslas.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static MagneticField From(QuantityValue value, MagneticFieldUnit fromUnit return new MagneticField((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MagneticField unit value. - public static MagneticField? From(QuantityValue? value, MagneticFieldUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MagneticField((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MagneticField operator -(MagneticField right) - { - return new MagneticField(-right.Value, right.Unit); - } - - public static MagneticField operator +(MagneticField left, MagneticField right) - { - return new MagneticField(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MagneticField operator -(MagneticField left, MagneticField right) - { - return new MagneticField(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MagneticField operator *(double left, MagneticField right) - { - return new MagneticField(left * right.Value, right.Unit); - } - - public static MagneticField operator *(MagneticField left, double right) - { - return new MagneticField(left.Value * right, left.Unit); - } - - public static MagneticField operator /(MagneticField left, double right) - { - return new MagneticField(left.Value / right, left.Unit); - } - - public static double operator /(MagneticField left, MagneticField right) - { - return left.Teslas / right.Teslas; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(MagneticField other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MagneticField left, MagneticField right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MagneticField left, MagneticField right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MagneticField left, MagneticField right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MagneticField left, MagneticField right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MagneticField left, MagneticField right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MagneticField left, MagneticField right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs index 6647147d5e..5748fa43fb 100644 --- a/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MagneticFlux.g.cs @@ -179,24 +179,6 @@ public static MagneticFlux FromWebers(QuantityValue webers) return new MagneticFlux(value, MagneticFluxUnit.Weber); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MagneticFlux from nullable Webers. - /// - public static MagneticFlux? FromWebers(QuantityValue? webers) - { - if (webers.HasValue) - { - return FromWebers(webers.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static MagneticFlux From(QuantityValue value, MagneticFluxUnit fromUnit) return new MagneticFlux((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MagneticFlux unit value. - public static MagneticFlux? From(QuantityValue? value, MagneticFluxUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MagneticFlux((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MagneticFlux operator -(MagneticFlux right) - { - return new MagneticFlux(-right.Value, right.Unit); - } - - public static MagneticFlux operator +(MagneticFlux left, MagneticFlux right) - { - return new MagneticFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MagneticFlux operator -(MagneticFlux left, MagneticFlux right) - { - return new MagneticFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MagneticFlux operator *(double left, MagneticFlux right) - { - return new MagneticFlux(left * right.Value, right.Unit); - } - - public static MagneticFlux operator *(MagneticFlux left, double right) - { - return new MagneticFlux(left.Value * right, left.Unit); - } - - public static MagneticFlux operator /(MagneticFlux left, double right) - { - return new MagneticFlux(left.Value / right, left.Unit); - } - - public static double operator /(MagneticFlux left, MagneticFlux right) - { - return left.Webers / right.Webers; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(MagneticFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MagneticFlux left, MagneticFlux right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MagneticFlux left, MagneticFlux right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MagneticFlux left, MagneticFlux right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MagneticFlux left, MagneticFlux right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MagneticFlux left, MagneticFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MagneticFlux left, MagneticFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs index 685093c23a..6efdadfd7f 100644 --- a/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Magnetization.g.cs @@ -179,24 +179,6 @@ public static Magnetization FromAmperesPerMeter(QuantityValue amperespermeter) return new Magnetization(value, MagnetizationUnit.AmperePerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Magnetization from nullable AmperesPerMeter. - /// - public static Magnetization? FromAmperesPerMeter(QuantityValue? amperespermeter) - { - if (amperespermeter.HasValue) - { - return FromAmperesPerMeter(amperespermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static Magnetization From(QuantityValue value, MagnetizationUnit fromUnit return new Magnetization((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Magnetization unit value. - public static Magnetization? From(QuantityValue? value, MagnetizationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Magnetization((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Magnetization operator -(Magnetization right) - { - return new Magnetization(-right.Value, right.Unit); - } - - public static Magnetization operator +(Magnetization left, Magnetization right) - { - return new Magnetization(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Magnetization operator -(Magnetization left, Magnetization right) - { - return new Magnetization(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Magnetization operator *(double left, Magnetization right) - { - return new Magnetization(left * right.Value, right.Unit); - } - - public static Magnetization operator *(Magnetization left, double right) - { - return new Magnetization(left.Value * right, left.Unit); - } - - public static Magnetization operator /(Magnetization left, double right) - { - return new Magnetization(left.Value / right, left.Unit); - } - - public static double operator /(Magnetization left, Magnetization right) - { - return left.AmperesPerMeter / right.AmperesPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(Magnetization other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Magnetization left, Magnetization right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Magnetization left, Magnetization right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Magnetization left, Magnetization right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Magnetization left, Magnetization right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Magnetization left, Magnetization right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Magnetization left, Magnetization right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs index c793e03af0..05c7328f37 100644 --- a/UnitsNet/GeneratedCode/Quantities/Mass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Mass.g.cs @@ -539,324 +539,6 @@ public static Mass FromTonnes(QuantityValue tonnes) return new Mass(value, MassUnit.Tonne); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Mass from nullable Centigrams. - /// - public static Mass? FromCentigrams(QuantityValue? centigrams) - { - if (centigrams.HasValue) - { - return FromCentigrams(centigrams.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Decagrams. - /// - public static Mass? FromDecagrams(QuantityValue? decagrams) - { - if (decagrams.HasValue) - { - return FromDecagrams(decagrams.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Decigrams. - /// - public static Mass? FromDecigrams(QuantityValue? decigrams) - { - if (decigrams.HasValue) - { - return FromDecigrams(decigrams.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Grams. - /// - public static Mass? FromGrams(QuantityValue? grams) - { - if (grams.HasValue) - { - return FromGrams(grams.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Hectograms. - /// - public static Mass? FromHectograms(QuantityValue? hectograms) - { - if (hectograms.HasValue) - { - return FromHectograms(hectograms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Kilograms. - /// - public static Mass? FromKilograms(QuantityValue? kilograms) - { - if (kilograms.HasValue) - { - return FromKilograms(kilograms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Kilopounds. - /// - public static Mass? FromKilopounds(QuantityValue? kilopounds) - { - if (kilopounds.HasValue) - { - return FromKilopounds(kilopounds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Kilotonnes. - /// - public static Mass? FromKilotonnes(QuantityValue? kilotonnes) - { - if (kilotonnes.HasValue) - { - return FromKilotonnes(kilotonnes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable LongHundredweight. - /// - public static Mass? FromLongHundredweight(QuantityValue? longhundredweight) - { - if (longhundredweight.HasValue) - { - return FromLongHundredweight(longhundredweight.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable LongTons. - /// - public static Mass? FromLongTons(QuantityValue? longtons) - { - if (longtons.HasValue) - { - return FromLongTons(longtons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Megapounds. - /// - public static Mass? FromMegapounds(QuantityValue? megapounds) - { - if (megapounds.HasValue) - { - return FromMegapounds(megapounds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Megatonnes. - /// - public static Mass? FromMegatonnes(QuantityValue? megatonnes) - { - if (megatonnes.HasValue) - { - return FromMegatonnes(megatonnes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Micrograms. - /// - public static Mass? FromMicrograms(QuantityValue? micrograms) - { - if (micrograms.HasValue) - { - return FromMicrograms(micrograms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Milligrams. - /// - public static Mass? FromMilligrams(QuantityValue? milligrams) - { - if (milligrams.HasValue) - { - return FromMilligrams(milligrams.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Nanograms. - /// - public static Mass? FromNanograms(QuantityValue? nanograms) - { - if (nanograms.HasValue) - { - return FromNanograms(nanograms.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Ounces. - /// - public static Mass? FromOunces(QuantityValue? ounces) - { - if (ounces.HasValue) - { - return FromOunces(ounces.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Pounds. - /// - public static Mass? FromPounds(QuantityValue? pounds) - { - if (pounds.HasValue) - { - return FromPounds(pounds.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable ShortHundredweight. - /// - public static Mass? FromShortHundredweight(QuantityValue? shorthundredweight) - { - if (shorthundredweight.HasValue) - { - return FromShortHundredweight(shorthundredweight.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable ShortTons. - /// - public static Mass? FromShortTons(QuantityValue? shorttons) - { - if (shorttons.HasValue) - { - return FromShortTons(shorttons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Stone. - /// - public static Mass? FromStone(QuantityValue? stone) - { - if (stone.HasValue) - { - return FromStone(stone.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Mass from nullable Tonnes. - /// - public static Mass? FromTonnes(QuantityValue? tonnes) - { - if (tonnes.HasValue) - { - return FromTonnes(tonnes.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -875,25 +557,6 @@ public static Mass From(QuantityValue value, MassUnit fromUnit) return new Mass((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Mass unit value. - public static Mass? From(QuantityValue? value, MassUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Mass((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -936,48 +599,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Mass operator -(Mass right) - { - return new Mass(-right.Value, right.Unit); - } - - public static Mass operator +(Mass left, Mass right) - { - return new Mass(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Mass operator -(Mass left, Mass right) - { - return new Mass(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Mass operator *(double left, Mass right) - { - return new Mass(left * right.Value, right.Unit); - } - - public static Mass operator *(Mass left, double right) - { - return new Mass(left.Value * right, left.Unit); - } - - public static Mass operator /(Mass left, double right) - { - return new Mass(left.Value / right, left.Unit); - } - - public static double operator /(Mass left, Mass right) - { - return left.Kilograms / right.Kilograms; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -999,43 +620,6 @@ int CompareTo(Mass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Mass left, Mass right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Mass left, Mass right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Mass left, Mass right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Mass left, Mass right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Mass left, Mass right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Mass left, Mass right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs index ec3cc79a86..8ab2ec3636 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlow.g.cs @@ -431,234 +431,6 @@ public static MassFlow FromTonnesPerHour(QuantityValue tonnesperhour) return new MassFlow(value, MassFlowUnit.TonnePerHour); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MassFlow from nullable CentigramsPerSecond. - /// - public static MassFlow? FromCentigramsPerSecond(QuantityValue? centigramspersecond) - { - if (centigramspersecond.HasValue) - { - return FromCentigramsPerSecond(centigramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable DecagramsPerSecond. - /// - public static MassFlow? FromDecagramsPerSecond(QuantityValue? decagramspersecond) - { - if (decagramspersecond.HasValue) - { - return FromDecagramsPerSecond(decagramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable DecigramsPerSecond. - /// - public static MassFlow? FromDecigramsPerSecond(QuantityValue? decigramspersecond) - { - if (decigramspersecond.HasValue) - { - return FromDecigramsPerSecond(decigramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable GramsPerSecond. - /// - public static MassFlow? FromGramsPerSecond(QuantityValue? gramspersecond) - { - if (gramspersecond.HasValue) - { - return FromGramsPerSecond(gramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable HectogramsPerSecond. - /// - public static MassFlow? FromHectogramsPerSecond(QuantityValue? hectogramspersecond) - { - if (hectogramspersecond.HasValue) - { - return FromHectogramsPerSecond(hectogramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable KilogramsPerHour. - /// - public static MassFlow? FromKilogramsPerHour(QuantityValue? kilogramsperhour) - { - if (kilogramsperhour.HasValue) - { - return FromKilogramsPerHour(kilogramsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable KilogramsPerSecond. - /// - public static MassFlow? FromKilogramsPerSecond(QuantityValue? kilogramspersecond) - { - if (kilogramspersecond.HasValue) - { - return FromKilogramsPerSecond(kilogramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable MegapoundsPerHour. - /// - public static MassFlow? FromMegapoundsPerHour(QuantityValue? megapoundsperhour) - { - if (megapoundsperhour.HasValue) - { - return FromMegapoundsPerHour(megapoundsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable MicrogramsPerSecond. - /// - public static MassFlow? FromMicrogramsPerSecond(QuantityValue? microgramspersecond) - { - if (microgramspersecond.HasValue) - { - return FromMicrogramsPerSecond(microgramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable MilligramsPerSecond. - /// - public static MassFlow? FromMilligramsPerSecond(QuantityValue? milligramspersecond) - { - if (milligramspersecond.HasValue) - { - return FromMilligramsPerSecond(milligramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable NanogramsPerSecond. - /// - public static MassFlow? FromNanogramsPerSecond(QuantityValue? nanogramspersecond) - { - if (nanogramspersecond.HasValue) - { - return FromNanogramsPerSecond(nanogramspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable PoundsPerHour. - /// - public static MassFlow? FromPoundsPerHour(QuantityValue? poundsperhour) - { - if (poundsperhour.HasValue) - { - return FromPoundsPerHour(poundsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable ShortTonsPerHour. - /// - public static MassFlow? FromShortTonsPerHour(QuantityValue? shorttonsperhour) - { - if (shorttonsperhour.HasValue) - { - return FromShortTonsPerHour(shorttonsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable TonnesPerDay. - /// - public static MassFlow? FromTonnesPerDay(QuantityValue? tonnesperday) - { - if (tonnesperday.HasValue) - { - return FromTonnesPerDay(tonnesperday.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlow from nullable TonnesPerHour. - /// - public static MassFlow? FromTonnesPerHour(QuantityValue? tonnesperhour) - { - if (tonnesperhour.HasValue) - { - return FromTonnesPerHour(tonnesperhour.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -677,25 +449,6 @@ public static MassFlow From(QuantityValue value, MassFlowUnit fromUnit) return new MassFlow((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassFlow unit value. - public static MassFlow? From(QuantityValue? value, MassFlowUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MassFlow((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -738,48 +491,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MassFlow operator -(MassFlow right) - { - return new MassFlow(-right.Value, right.Unit); - } - - public static MassFlow operator +(MassFlow left, MassFlow right) - { - return new MassFlow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassFlow operator -(MassFlow left, MassFlow right) - { - return new MassFlow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassFlow operator *(double left, MassFlow right) - { - return new MassFlow(left * right.Value, right.Unit); - } - - public static MassFlow operator *(MassFlow left, double right) - { - return new MassFlow(left.Value * right, left.Unit); - } - - public static MassFlow operator /(MassFlow left, double right) - { - return new MassFlow(left.Value / right, left.Unit); - } - - public static double operator /(MassFlow left, MassFlow right) - { - return left.GramsPerSecond / right.GramsPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -801,43 +512,6 @@ int CompareTo(MassFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MassFlow left, MassFlow right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MassFlow left, MassFlow right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MassFlow left, MassFlow right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MassFlow left, MassFlow right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MassFlow left, MassFlow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MassFlow left, MassFlow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs index e7a9d0bcb4..5c3059fb55 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassFlux.g.cs @@ -197,39 +197,6 @@ public static MassFlux FromKilogramsPerSecondPerSquareMeter(QuantityValue kilogr return new MassFlux(value, MassFluxUnit.KilogramPerSecondPerSquareMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MassFlux from nullable GramsPerSecondPerSquareMeter. - /// - public static MassFlux? FromGramsPerSecondPerSquareMeter(QuantityValue? gramspersecondpersquaremeter) - { - if (gramspersecondpersquaremeter.HasValue) - { - return FromGramsPerSecondPerSquareMeter(gramspersecondpersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassFlux from nullable KilogramsPerSecondPerSquareMeter. - /// - public static MassFlux? FromKilogramsPerSecondPerSquareMeter(QuantityValue? kilogramspersecondpersquaremeter) - { - if (kilogramspersecondpersquaremeter.HasValue) - { - return FromKilogramsPerSecondPerSquareMeter(kilogramspersecondpersquaremeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -248,25 +215,6 @@ public static MassFlux From(QuantityValue value, MassFluxUnit fromUnit) return new MassFlux((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassFlux unit value. - public static MassFlux? From(QuantityValue? value, MassFluxUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MassFlux((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -309,48 +257,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MassFlux operator -(MassFlux right) - { - return new MassFlux(-right.Value, right.Unit); - } - - public static MassFlux operator +(MassFlux left, MassFlux right) - { - return new MassFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassFlux operator -(MassFlux left, MassFlux right) - { - return new MassFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassFlux operator *(double left, MassFlux right) - { - return new MassFlux(left * right.Value, right.Unit); - } - - public static MassFlux operator *(MassFlux left, double right) - { - return new MassFlux(left.Value * right, left.Unit); - } - - public static MassFlux operator /(MassFlux left, double right) - { - return new MassFlux(left.Value / right, left.Unit); - } - - public static double operator /(MassFlux left, MassFlux right) - { - return left.KilogramsPerSecondPerSquareMeter / right.KilogramsPerSecondPerSquareMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -372,43 +278,6 @@ int CompareTo(MassFlux other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MassFlux left, MassFlux right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MassFlux left, MassFlux right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MassFlux left, MassFlux right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MassFlux left, MassFlux right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MassFlux left, MassFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MassFlux left, MassFlux right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs index e4b1f6ac62..5eb2db2e63 100644 --- a/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MassMomentOfInertia.g.cs @@ -629,399 +629,6 @@ public static MassMomentOfInertia FromTonneSquareMilimeters(QuantityValue tonnes return new MassMomentOfInertia(value, MassMomentOfInertiaUnit.TonneSquareMilimeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareCentimeters. - /// - public static MassMomentOfInertia? FromGramSquareCentimeters(QuantityValue? gramsquarecentimeters) - { - if (gramsquarecentimeters.HasValue) - { - return FromGramSquareCentimeters(gramsquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareDecimeters. - /// - public static MassMomentOfInertia? FromGramSquareDecimeters(QuantityValue? gramsquaredecimeters) - { - if (gramsquaredecimeters.HasValue) - { - return FromGramSquareDecimeters(gramsquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareMeters. - /// - public static MassMomentOfInertia? FromGramSquareMeters(QuantityValue? gramsquaremeters) - { - if (gramsquaremeters.HasValue) - { - return FromGramSquareMeters(gramsquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable GramSquareMillimeters. - /// - public static MassMomentOfInertia? FromGramSquareMillimeters(QuantityValue? gramsquaremillimeters) - { - if (gramsquaremillimeters.HasValue) - { - return FromGramSquareMillimeters(gramsquaremillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareCentimeters. - /// - public static MassMomentOfInertia? FromKilogramSquareCentimeters(QuantityValue? kilogramsquarecentimeters) - { - if (kilogramsquarecentimeters.HasValue) - { - return FromKilogramSquareCentimeters(kilogramsquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareDecimeters. - /// - public static MassMomentOfInertia? FromKilogramSquareDecimeters(QuantityValue? kilogramsquaredecimeters) - { - if (kilogramsquaredecimeters.HasValue) - { - return FromKilogramSquareDecimeters(kilogramsquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareMeters. - /// - public static MassMomentOfInertia? FromKilogramSquareMeters(QuantityValue? kilogramsquaremeters) - { - if (kilogramsquaremeters.HasValue) - { - return FromKilogramSquareMeters(kilogramsquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilogramSquareMillimeters. - /// - public static MassMomentOfInertia? FromKilogramSquareMillimeters(QuantityValue? kilogramsquaremillimeters) - { - if (kilogramsquaremillimeters.HasValue) - { - return FromKilogramSquareMillimeters(kilogramsquaremillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareCentimeters. - /// - public static MassMomentOfInertia? FromKilotonneSquareCentimeters(QuantityValue? kilotonnesquarecentimeters) - { - if (kilotonnesquarecentimeters.HasValue) - { - return FromKilotonneSquareCentimeters(kilotonnesquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareDecimeters. - /// - public static MassMomentOfInertia? FromKilotonneSquareDecimeters(QuantityValue? kilotonnesquaredecimeters) - { - if (kilotonnesquaredecimeters.HasValue) - { - return FromKilotonneSquareDecimeters(kilotonnesquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMeters. - /// - public static MassMomentOfInertia? FromKilotonneSquareMeters(QuantityValue? kilotonnesquaremeters) - { - if (kilotonnesquaremeters.HasValue) - { - return FromKilotonneSquareMeters(kilotonnesquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMilimeters. - /// - public static MassMomentOfInertia? FromKilotonneSquareMilimeters(QuantityValue? kilotonnesquaremilimeters) - { - if (kilotonnesquaremilimeters.HasValue) - { - return FromKilotonneSquareMilimeters(kilotonnesquaremilimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareCentimeters. - /// - public static MassMomentOfInertia? FromMegatonneSquareCentimeters(QuantityValue? megatonnesquarecentimeters) - { - if (megatonnesquarecentimeters.HasValue) - { - return FromMegatonneSquareCentimeters(megatonnesquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareDecimeters. - /// - public static MassMomentOfInertia? FromMegatonneSquareDecimeters(QuantityValue? megatonnesquaredecimeters) - { - if (megatonnesquaredecimeters.HasValue) - { - return FromMegatonneSquareDecimeters(megatonnesquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMeters. - /// - public static MassMomentOfInertia? FromMegatonneSquareMeters(QuantityValue? megatonnesquaremeters) - { - if (megatonnesquaremeters.HasValue) - { - return FromMegatonneSquareMeters(megatonnesquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMilimeters. - /// - public static MassMomentOfInertia? FromMegatonneSquareMilimeters(QuantityValue? megatonnesquaremilimeters) - { - if (megatonnesquaremilimeters.HasValue) - { - return FromMegatonneSquareMilimeters(megatonnesquaremilimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareCentimeters. - /// - public static MassMomentOfInertia? FromMilligramSquareCentimeters(QuantityValue? milligramsquarecentimeters) - { - if (milligramsquarecentimeters.HasValue) - { - return FromMilligramSquareCentimeters(milligramsquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareDecimeters. - /// - public static MassMomentOfInertia? FromMilligramSquareDecimeters(QuantityValue? milligramsquaredecimeters) - { - if (milligramsquaredecimeters.HasValue) - { - return FromMilligramSquareDecimeters(milligramsquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareMeters. - /// - public static MassMomentOfInertia? FromMilligramSquareMeters(QuantityValue? milligramsquaremeters) - { - if (milligramsquaremeters.HasValue) - { - return FromMilligramSquareMeters(milligramsquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable MilligramSquareMillimeters. - /// - public static MassMomentOfInertia? FromMilligramSquareMillimeters(QuantityValue? milligramsquaremillimeters) - { - if (milligramsquaremillimeters.HasValue) - { - return FromMilligramSquareMillimeters(milligramsquaremillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable PoundSquareFeet. - /// - public static MassMomentOfInertia? FromPoundSquareFeet(QuantityValue? poundsquarefeet) - { - if (poundsquarefeet.HasValue) - { - return FromPoundSquareFeet(poundsquarefeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable PoundSquareInches. - /// - public static MassMomentOfInertia? FromPoundSquareInches(QuantityValue? poundsquareinches) - { - if (poundsquareinches.HasValue) - { - return FromPoundSquareInches(poundsquareinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareCentimeters. - /// - public static MassMomentOfInertia? FromTonneSquareCentimeters(QuantityValue? tonnesquarecentimeters) - { - if (tonnesquarecentimeters.HasValue) - { - return FromTonneSquareCentimeters(tonnesquarecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareDecimeters. - /// - public static MassMomentOfInertia? FromTonneSquareDecimeters(QuantityValue? tonnesquaredecimeters) - { - if (tonnesquaredecimeters.HasValue) - { - return FromTonneSquareDecimeters(tonnesquaredecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareMeters. - /// - public static MassMomentOfInertia? FromTonneSquareMeters(QuantityValue? tonnesquaremeters) - { - if (tonnesquaremeters.HasValue) - { - return FromTonneSquareMeters(tonnesquaremeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MassMomentOfInertia from nullable TonneSquareMilimeters. - /// - public static MassMomentOfInertia? FromTonneSquareMilimeters(QuantityValue? tonnesquaremilimeters) - { - if (tonnesquaremilimeters.HasValue) - { - return FromTonneSquareMilimeters(tonnesquaremilimeters.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1040,25 +647,6 @@ public static MassMomentOfInertia From(QuantityValue value, MassMomentOfInertiaU return new MassMomentOfInertia((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MassMomentOfInertia unit value. - public static MassMomentOfInertia? From(QuantityValue? value, MassMomentOfInertiaUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MassMomentOfInertia((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1101,48 +689,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MassMomentOfInertia operator -(MassMomentOfInertia right) - { - return new MassMomentOfInertia(-right.Value, right.Unit); - } - - public static MassMomentOfInertia operator +(MassMomentOfInertia left, MassMomentOfInertia right) - { - return new MassMomentOfInertia(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassMomentOfInertia operator -(MassMomentOfInertia left, MassMomentOfInertia right) - { - return new MassMomentOfInertia(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MassMomentOfInertia operator *(double left, MassMomentOfInertia right) - { - return new MassMomentOfInertia(left * right.Value, right.Unit); - } - - public static MassMomentOfInertia operator *(MassMomentOfInertia left, double right) - { - return new MassMomentOfInertia(left.Value * right, left.Unit); - } - - public static MassMomentOfInertia operator /(MassMomentOfInertia left, double right) - { - return new MassMomentOfInertia(left.Value / right, left.Unit); - } - - public static double operator /(MassMomentOfInertia left, MassMomentOfInertia right) - { - return left.KilogramSquareMeters / right.KilogramSquareMeters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1164,43 +710,6 @@ int CompareTo(MassMomentOfInertia other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MassMomentOfInertia left, MassMomentOfInertia right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MassMomentOfInertia left, MassMomentOfInertia right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs index 252fca6a0c..d716163d9f 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEnergy.g.cs @@ -215,54 +215,6 @@ public static MolarEnergy FromMegajoulesPerMole(QuantityValue megajoulespermole) return new MolarEnergy(value, MolarEnergyUnit.MegajoulePerMole); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MolarEnergy from nullable JoulesPerMole. - /// - public static MolarEnergy? FromJoulesPerMole(QuantityValue? joulespermole) - { - if (joulespermole.HasValue) - { - return FromJoulesPerMole(joulespermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarEnergy from nullable KilojoulesPerMole. - /// - public static MolarEnergy? FromKilojoulesPerMole(QuantityValue? kilojoulespermole) - { - if (kilojoulespermole.HasValue) - { - return FromKilojoulesPerMole(kilojoulespermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarEnergy from nullable MegajoulesPerMole. - /// - public static MolarEnergy? FromMegajoulesPerMole(QuantityValue? megajoulespermole) - { - if (megajoulespermole.HasValue) - { - return FromMegajoulesPerMole(megajoulespermole.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static MolarEnergy From(QuantityValue value, MolarEnergyUnit fromUnit) return new MolarEnergy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarEnergy unit value. - public static MolarEnergy? From(QuantityValue? value, MolarEnergyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MolarEnergy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MolarEnergy operator -(MolarEnergy right) - { - return new MolarEnergy(-right.Value, right.Unit); - } - - public static MolarEnergy operator +(MolarEnergy left, MolarEnergy right) - { - return new MolarEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarEnergy operator -(MolarEnergy left, MolarEnergy right) - { - return new MolarEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarEnergy operator *(double left, MolarEnergy right) - { - return new MolarEnergy(left * right.Value, right.Unit); - } - - public static MolarEnergy operator *(MolarEnergy left, double right) - { - return new MolarEnergy(left.Value * right, left.Unit); - } - - public static MolarEnergy operator /(MolarEnergy left, double right) - { - return new MolarEnergy(left.Value / right, left.Unit); - } - - public static double operator /(MolarEnergy left, MolarEnergy right) - { - return left.JoulesPerMole / right.JoulesPerMole; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(MolarEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MolarEnergy left, MolarEnergy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MolarEnergy left, MolarEnergy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MolarEnergy left, MolarEnergy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MolarEnergy left, MolarEnergy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MolarEnergy left, MolarEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MolarEnergy left, MolarEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs index c2370b839e..85b87ec68a 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarEntropy.g.cs @@ -215,54 +215,6 @@ public static MolarEntropy FromMegajoulesPerMoleKelvin(QuantityValue megajoulesp return new MolarEntropy(value, MolarEntropyUnit.MegajoulePerMoleKelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MolarEntropy from nullable JoulesPerMoleKelvin. - /// - public static MolarEntropy? FromJoulesPerMoleKelvin(QuantityValue? joulespermolekelvin) - { - if (joulespermolekelvin.HasValue) - { - return FromJoulesPerMoleKelvin(joulespermolekelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarEntropy from nullable KilojoulesPerMoleKelvin. - /// - public static MolarEntropy? FromKilojoulesPerMoleKelvin(QuantityValue? kilojoulespermolekelvin) - { - if (kilojoulespermolekelvin.HasValue) - { - return FromKilojoulesPerMoleKelvin(kilojoulespermolekelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarEntropy from nullable MegajoulesPerMoleKelvin. - /// - public static MolarEntropy? FromMegajoulesPerMoleKelvin(QuantityValue? megajoulespermolekelvin) - { - if (megajoulespermolekelvin.HasValue) - { - return FromMegajoulesPerMoleKelvin(megajoulespermolekelvin.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static MolarEntropy From(QuantityValue value, MolarEntropyUnit fromUnit) return new MolarEntropy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarEntropy unit value. - public static MolarEntropy? From(QuantityValue? value, MolarEntropyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MolarEntropy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MolarEntropy operator -(MolarEntropy right) - { - return new MolarEntropy(-right.Value, right.Unit); - } - - public static MolarEntropy operator +(MolarEntropy left, MolarEntropy right) - { - return new MolarEntropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarEntropy operator -(MolarEntropy left, MolarEntropy right) - { - return new MolarEntropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarEntropy operator *(double left, MolarEntropy right) - { - return new MolarEntropy(left * right.Value, right.Unit); - } - - public static MolarEntropy operator *(MolarEntropy left, double right) - { - return new MolarEntropy(left.Value * right, left.Unit); - } - - public static MolarEntropy operator /(MolarEntropy left, double right) - { - return new MolarEntropy(left.Value / right, left.Unit); - } - - public static double operator /(MolarEntropy left, MolarEntropy right) - { - return left.JoulesPerMoleKelvin / right.JoulesPerMoleKelvin; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(MolarEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MolarEntropy left, MolarEntropy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MolarEntropy left, MolarEntropy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MolarEntropy left, MolarEntropy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MolarEntropy left, MolarEntropy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MolarEntropy left, MolarEntropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MolarEntropy left, MolarEntropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs index f13e3cfbf3..c88391a7ba 100644 --- a/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/MolarMass.g.cs @@ -377,189 +377,6 @@ public static MolarMass FromPoundsPerMole(QuantityValue poundspermole) return new MolarMass(value, MolarMassUnit.PoundPerMole); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable MolarMass from nullable CentigramsPerMole. - /// - public static MolarMass? FromCentigramsPerMole(QuantityValue? centigramspermole) - { - if (centigramspermole.HasValue) - { - return FromCentigramsPerMole(centigramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable DecagramsPerMole. - /// - public static MolarMass? FromDecagramsPerMole(QuantityValue? decagramspermole) - { - if (decagramspermole.HasValue) - { - return FromDecagramsPerMole(decagramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable DecigramsPerMole. - /// - public static MolarMass? FromDecigramsPerMole(QuantityValue? decigramspermole) - { - if (decigramspermole.HasValue) - { - return FromDecigramsPerMole(decigramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable GramsPerMole. - /// - public static MolarMass? FromGramsPerMole(QuantityValue? gramspermole) - { - if (gramspermole.HasValue) - { - return FromGramsPerMole(gramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable HectogramsPerMole. - /// - public static MolarMass? FromHectogramsPerMole(QuantityValue? hectogramspermole) - { - if (hectogramspermole.HasValue) - { - return FromHectogramsPerMole(hectogramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable KilogramsPerMole. - /// - public static MolarMass? FromKilogramsPerMole(QuantityValue? kilogramspermole) - { - if (kilogramspermole.HasValue) - { - return FromKilogramsPerMole(kilogramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable KilopoundsPerMole. - /// - public static MolarMass? FromKilopoundsPerMole(QuantityValue? kilopoundspermole) - { - if (kilopoundspermole.HasValue) - { - return FromKilopoundsPerMole(kilopoundspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable MegapoundsPerMole. - /// - public static MolarMass? FromMegapoundsPerMole(QuantityValue? megapoundspermole) - { - if (megapoundspermole.HasValue) - { - return FromMegapoundsPerMole(megapoundspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable MicrogramsPerMole. - /// - public static MolarMass? FromMicrogramsPerMole(QuantityValue? microgramspermole) - { - if (microgramspermole.HasValue) - { - return FromMicrogramsPerMole(microgramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable MilligramsPerMole. - /// - public static MolarMass? FromMilligramsPerMole(QuantityValue? milligramspermole) - { - if (milligramspermole.HasValue) - { - return FromMilligramsPerMole(milligramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable NanogramsPerMole. - /// - public static MolarMass? FromNanogramsPerMole(QuantityValue? nanogramspermole) - { - if (nanogramspermole.HasValue) - { - return FromNanogramsPerMole(nanogramspermole.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable MolarMass from nullable PoundsPerMole. - /// - public static MolarMass? FromPoundsPerMole(QuantityValue? poundspermole) - { - if (poundspermole.HasValue) - { - return FromPoundsPerMole(poundspermole.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -578,25 +395,6 @@ public static MolarMass From(QuantityValue value, MolarMassUnit fromUnit) return new MolarMass((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// MolarMass unit value. - public static MolarMass? From(QuantityValue? value, MolarMassUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new MolarMass((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -639,48 +437,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static MolarMass operator -(MolarMass right) - { - return new MolarMass(-right.Value, right.Unit); - } - - public static MolarMass operator +(MolarMass left, MolarMass right) - { - return new MolarMass(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarMass operator -(MolarMass left, MolarMass right) - { - return new MolarMass(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static MolarMass operator *(double left, MolarMass right) - { - return new MolarMass(left * right.Value, right.Unit); - } - - public static MolarMass operator *(MolarMass left, double right) - { - return new MolarMass(left.Value * right, left.Unit); - } - - public static MolarMass operator /(MolarMass left, double right) - { - return new MolarMass(left.Value / right, left.Unit); - } - - public static double operator /(MolarMass left, MolarMass right) - { - return left.KilogramsPerMole / right.KilogramsPerMole; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -702,43 +458,6 @@ int CompareTo(MolarMass other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(MolarMass left, MolarMass right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(MolarMass left, MolarMass right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(MolarMass left, MolarMass right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(MolarMass left, MolarMass right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(MolarMass left, MolarMass right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(MolarMass left, MolarMass right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs index b154a1705e..186a88547b 100644 --- a/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Molarity.g.cs @@ -305,129 +305,6 @@ public static Molarity FromPicomolesPerLiter(QuantityValue picomolesperliter) return new Molarity(value, MolarityUnit.PicomolesPerLiter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Molarity from nullable CentimolesPerLiter. - /// - public static Molarity? FromCentimolesPerLiter(QuantityValue? centimolesperliter) - { - if (centimolesperliter.HasValue) - { - return FromCentimolesPerLiter(centimolesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable DecimolesPerLiter. - /// - public static Molarity? FromDecimolesPerLiter(QuantityValue? decimolesperliter) - { - if (decimolesperliter.HasValue) - { - return FromDecimolesPerLiter(decimolesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable MicromolesPerLiter. - /// - public static Molarity? FromMicromolesPerLiter(QuantityValue? micromolesperliter) - { - if (micromolesperliter.HasValue) - { - return FromMicromolesPerLiter(micromolesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable MillimolesPerLiter. - /// - public static Molarity? FromMillimolesPerLiter(QuantityValue? millimolesperliter) - { - if (millimolesperliter.HasValue) - { - return FromMillimolesPerLiter(millimolesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable MolesPerCubicMeter. - /// - public static Molarity? FromMolesPerCubicMeter(QuantityValue? molespercubicmeter) - { - if (molespercubicmeter.HasValue) - { - return FromMolesPerCubicMeter(molespercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable MolesPerLiter. - /// - public static Molarity? FromMolesPerLiter(QuantityValue? molesperliter) - { - if (molesperliter.HasValue) - { - return FromMolesPerLiter(molesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable NanomolesPerLiter. - /// - public static Molarity? FromNanomolesPerLiter(QuantityValue? nanomolesperliter) - { - if (nanomolesperliter.HasValue) - { - return FromNanomolesPerLiter(nanomolesperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Molarity from nullable PicomolesPerLiter. - /// - public static Molarity? FromPicomolesPerLiter(QuantityValue? picomolesperliter) - { - if (picomolesperliter.HasValue) - { - return FromPicomolesPerLiter(picomolesperliter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static Molarity From(QuantityValue value, MolarityUnit fromUnit) return new Molarity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Molarity unit value. - public static Molarity? From(QuantityValue? value, MolarityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Molarity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -507,48 +365,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Molarity operator -(Molarity right) - { - return new Molarity(-right.Value, right.Unit); - } - - public static Molarity operator +(Molarity left, Molarity right) - { - return new Molarity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Molarity operator -(Molarity left, Molarity right) - { - return new Molarity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Molarity operator *(double left, Molarity right) - { - return new Molarity(left * right.Value, right.Unit); - } - - public static Molarity operator *(Molarity left, double right) - { - return new Molarity(left.Value * right, left.Unit); - } - - public static Molarity operator /(Molarity left, double right) - { - return new Molarity(left.Value / right, left.Unit); - } - - public static double operator /(Molarity left, Molarity right) - { - return left.MolesPerCubicMeter / right.MolesPerCubicMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -570,43 +386,6 @@ int CompareTo(Molarity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Molarity left, Molarity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Molarity left, Molarity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Molarity left, Molarity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Molarity left, Molarity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Molarity left, Molarity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Molarity left, Molarity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Acceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Acceleration.NetFramework.g.cs index 50e2f9d327..5e6a87771d 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Acceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Acceleration.NetFramework.g.cs @@ -59,5 +59,197 @@ public partial struct Acceleration : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Acceleration from nullable CentimetersPerSecondSquared. + /// + public static Acceleration? FromCentimetersPerSecondSquared(QuantityValue? centimeterspersecondsquared) + { + return centimeterspersecondsquared.HasValue ? FromCentimetersPerSecondSquared(centimeterspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable DecimetersPerSecondSquared. + /// + public static Acceleration? FromDecimetersPerSecondSquared(QuantityValue? decimeterspersecondsquared) + { + return decimeterspersecondsquared.HasValue ? FromDecimetersPerSecondSquared(decimeterspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable FeetPerSecondSquared. + /// + public static Acceleration? FromFeetPerSecondSquared(QuantityValue? feetpersecondsquared) + { + return feetpersecondsquared.HasValue ? FromFeetPerSecondSquared(feetpersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable InchesPerSecondSquared. + /// + public static Acceleration? FromInchesPerSecondSquared(QuantityValue? inchespersecondsquared) + { + return inchespersecondsquared.HasValue ? FromInchesPerSecondSquared(inchespersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable KilometersPerSecondSquared. + /// + public static Acceleration? FromKilometersPerSecondSquared(QuantityValue? kilometerspersecondsquared) + { + return kilometerspersecondsquared.HasValue ? FromKilometersPerSecondSquared(kilometerspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable KnotsPerHour. + /// + public static Acceleration? FromKnotsPerHour(QuantityValue? knotsperhour) + { + return knotsperhour.HasValue ? FromKnotsPerHour(knotsperhour.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable KnotsPerMinute. + /// + public static Acceleration? FromKnotsPerMinute(QuantityValue? knotsperminute) + { + return knotsperminute.HasValue ? FromKnotsPerMinute(knotsperminute.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable KnotsPerSecond. + /// + public static Acceleration? FromKnotsPerSecond(QuantityValue? knotspersecond) + { + return knotspersecond.HasValue ? FromKnotsPerSecond(knotspersecond.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable MetersPerSecondSquared. + /// + public static Acceleration? FromMetersPerSecondSquared(QuantityValue? meterspersecondsquared) + { + return meterspersecondsquared.HasValue ? FromMetersPerSecondSquared(meterspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable MicrometersPerSecondSquared. + /// + public static Acceleration? FromMicrometersPerSecondSquared(QuantityValue? micrometerspersecondsquared) + { + return micrometerspersecondsquared.HasValue ? FromMicrometersPerSecondSquared(micrometerspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable MillimetersPerSecondSquared. + /// + public static Acceleration? FromMillimetersPerSecondSquared(QuantityValue? millimeterspersecondsquared) + { + return millimeterspersecondsquared.HasValue ? FromMillimetersPerSecondSquared(millimeterspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable NanometersPerSecondSquared. + /// + public static Acceleration? FromNanometersPerSecondSquared(QuantityValue? nanometerspersecondsquared) + { + return nanometerspersecondsquared.HasValue ? FromNanometersPerSecondSquared(nanometerspersecondsquared.Value) : default(Acceleration?); + } + + /// + /// Get nullable Acceleration from nullable StandardGravity. + /// + public static Acceleration? FromStandardGravity(QuantityValue? standardgravity) + { + return standardgravity.HasValue ? FromStandardGravity(standardgravity.Value) : default(Acceleration?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Acceleration unit value. + public static Acceleration? From(QuantityValue? value, AccelerationUnit fromUnit) + { + return value.HasValue ? new Acceleration((double)value.Value, fromUnit) : default(Acceleration?); + } + + #endregion + + #region Arithmetic Operators + + public static Acceleration operator -(Acceleration right) + { + return new Acceleration(-right.Value, right.Unit); + } + + public static Acceleration operator +(Acceleration left, Acceleration right) + { + return new Acceleration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Acceleration operator -(Acceleration left, Acceleration right) + { + return new Acceleration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Acceleration operator *(double left, Acceleration right) + { + return new Acceleration(left * right.Value, right.Unit); + } + + public static Acceleration operator *(Acceleration left, double right) + { + return new Acceleration(left.Value * right, left.Unit); + } + + public static Acceleration operator /(Acceleration left, double right) + { + return new Acceleration(left.Value / right, left.Unit); + } + + public static double operator /(Acceleration left, Acceleration right) + { + return left.MetersPerSecondSquared / right.MetersPerSecondSquared; + } + + #endregion + + public static bool operator <=(Acceleration left, Acceleration right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Acceleration left, Acceleration right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Acceleration left, Acceleration right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Acceleration left, Acceleration right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Acceleration left, Acceleration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Acceleration left, Acceleration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/AmountOfSubstance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/AmountOfSubstance.NetFramework.g.cs index f3e2518195..4d48b56b58 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/AmountOfSubstance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/AmountOfSubstance.NetFramework.g.cs @@ -59,5 +59,205 @@ public partial struct AmountOfSubstance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable AmountOfSubstance from nullable Centimoles. + /// + public static AmountOfSubstance? FromCentimoles(QuantityValue? centimoles) + { + return centimoles.HasValue ? FromCentimoles(centimoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable CentipoundMoles. + /// + public static AmountOfSubstance? FromCentipoundMoles(QuantityValue? centipoundmoles) + { + return centipoundmoles.HasValue ? FromCentipoundMoles(centipoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Decimoles. + /// + public static AmountOfSubstance? FromDecimoles(QuantityValue? decimoles) + { + return decimoles.HasValue ? FromDecimoles(decimoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable DecipoundMoles. + /// + public static AmountOfSubstance? FromDecipoundMoles(QuantityValue? decipoundmoles) + { + return decipoundmoles.HasValue ? FromDecipoundMoles(decipoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Kilomoles. + /// + public static AmountOfSubstance? FromKilomoles(QuantityValue? kilomoles) + { + return kilomoles.HasValue ? FromKilomoles(kilomoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable KilopoundMoles. + /// + public static AmountOfSubstance? FromKilopoundMoles(QuantityValue? kilopoundmoles) + { + return kilopoundmoles.HasValue ? FromKilopoundMoles(kilopoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Micromoles. + /// + public static AmountOfSubstance? FromMicromoles(QuantityValue? micromoles) + { + return micromoles.HasValue ? FromMicromoles(micromoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable MicropoundMoles. + /// + public static AmountOfSubstance? FromMicropoundMoles(QuantityValue? micropoundmoles) + { + return micropoundmoles.HasValue ? FromMicropoundMoles(micropoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Millimoles. + /// + public static AmountOfSubstance? FromMillimoles(QuantityValue? millimoles) + { + return millimoles.HasValue ? FromMillimoles(millimoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable MillipoundMoles. + /// + public static AmountOfSubstance? FromMillipoundMoles(QuantityValue? millipoundmoles) + { + return millipoundmoles.HasValue ? FromMillipoundMoles(millipoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Moles. + /// + public static AmountOfSubstance? FromMoles(QuantityValue? moles) + { + return moles.HasValue ? FromMoles(moles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable Nanomoles. + /// + public static AmountOfSubstance? FromNanomoles(QuantityValue? nanomoles) + { + return nanomoles.HasValue ? FromNanomoles(nanomoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable NanopoundMoles. + /// + public static AmountOfSubstance? FromNanopoundMoles(QuantityValue? nanopoundmoles) + { + return nanopoundmoles.HasValue ? FromNanopoundMoles(nanopoundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Get nullable AmountOfSubstance from nullable PoundMoles. + /// + public static AmountOfSubstance? FromPoundMoles(QuantityValue? poundmoles) + { + return poundmoles.HasValue ? FromPoundMoles(poundmoles.Value) : default(AmountOfSubstance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AmountOfSubstance unit value. + public static AmountOfSubstance? From(QuantityValue? value, AmountOfSubstanceUnit fromUnit) + { + return value.HasValue ? new AmountOfSubstance((double)value.Value, fromUnit) : default(AmountOfSubstance?); + } + + #endregion + + #region Arithmetic Operators + + public static AmountOfSubstance operator -(AmountOfSubstance right) + { + return new AmountOfSubstance(-right.Value, right.Unit); + } + + public static AmountOfSubstance operator +(AmountOfSubstance left, AmountOfSubstance right) + { + return new AmountOfSubstance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AmountOfSubstance operator -(AmountOfSubstance left, AmountOfSubstance right) + { + return new AmountOfSubstance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AmountOfSubstance operator *(double left, AmountOfSubstance right) + { + return new AmountOfSubstance(left * right.Value, right.Unit); + } + + public static AmountOfSubstance operator *(AmountOfSubstance left, double right) + { + return new AmountOfSubstance(left.Value * right, left.Unit); + } + + public static AmountOfSubstance operator /(AmountOfSubstance left, double right) + { + return new AmountOfSubstance(left.Value / right, left.Unit); + } + + public static double operator /(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Moles / right.Moles; + } + + #endregion + + public static bool operator <=(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(AmountOfSubstance left, AmountOfSubstance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(AmountOfSubstance left, AmountOfSubstance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(AmountOfSubstance left, AmountOfSubstance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/AmplitudeRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/AmplitudeRatio.NetFramework.g.cs index e06fd59321..f02b3a78e6 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/AmplitudeRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/AmplitudeRatio.NetFramework.g.cs @@ -59,5 +59,133 @@ public partial struct AmplitudeRatio : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable AmplitudeRatio from nullable DecibelMicrovolts. + /// + public static AmplitudeRatio? FromDecibelMicrovolts(QuantityValue? decibelmicrovolts) + { + return decibelmicrovolts.HasValue ? FromDecibelMicrovolts(decibelmicrovolts.Value) : default(AmplitudeRatio?); + } + + /// + /// Get nullable AmplitudeRatio from nullable DecibelMillivolts. + /// + public static AmplitudeRatio? FromDecibelMillivolts(QuantityValue? decibelmillivolts) + { + return decibelmillivolts.HasValue ? FromDecibelMillivolts(decibelmillivolts.Value) : default(AmplitudeRatio?); + } + + /// + /// Get nullable AmplitudeRatio from nullable DecibelsUnloaded. + /// + public static AmplitudeRatio? FromDecibelsUnloaded(QuantityValue? decibelsunloaded) + { + return decibelsunloaded.HasValue ? FromDecibelsUnloaded(decibelsunloaded.Value) : default(AmplitudeRatio?); + } + + /// + /// Get nullable AmplitudeRatio from nullable DecibelVolts. + /// + public static AmplitudeRatio? FromDecibelVolts(QuantityValue? decibelvolts) + { + return decibelvolts.HasValue ? FromDecibelVolts(decibelvolts.Value) : default(AmplitudeRatio?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AmplitudeRatio unit value. + public static AmplitudeRatio? From(QuantityValue? value, AmplitudeRatioUnit fromUnit) + { + return value.HasValue ? new AmplitudeRatio((double)value.Value, fromUnit) : default(AmplitudeRatio?); + } + + #endregion + + #region Logarithmic Arithmetic Operators + + public static AmplitudeRatio operator -(AmplitudeRatio right) + { + return new AmplitudeRatio(-right.Value, right.Unit); + } + + public static AmplitudeRatio operator +(AmplitudeRatio left, AmplitudeRatio right) + { + // Logarithmic addition + // Formula: 20*log10(10^(x/20) + 10^(y/20)) + return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/20)), left.Unit); + } + + public static AmplitudeRatio operator -(AmplitudeRatio left, AmplitudeRatio right) + { + // Logarithmic subtraction + // Formula: 20*log10(10^(x/20) - 10^(y/20)) + return new AmplitudeRatio(20*Math.Log10(Math.Pow(10, left.Value/20) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/20)), left.Unit); + } + + public static AmplitudeRatio operator *(double left, AmplitudeRatio right) + { + // Logarithmic multiplication = addition + return new AmplitudeRatio(left + right.Value, right.Unit); + } + + public static AmplitudeRatio operator *(AmplitudeRatio left, double right) + { + // Logarithmic multiplication = addition + return new AmplitudeRatio(left.Value + (double)right, left.Unit); + } + + public static AmplitudeRatio operator /(AmplitudeRatio left, double right) + { + // Logarithmic division = subtraction + return new AmplitudeRatio(left.Value - (double)right, left.Unit); + } + + public static double operator /(AmplitudeRatio left, AmplitudeRatio right) + { + // Logarithmic division = subtraction + return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); + } + + #endregion + + public static bool operator <=(AmplitudeRatio left, AmplitudeRatio right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(AmplitudeRatio left, AmplitudeRatio right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(AmplitudeRatio left, AmplitudeRatio right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(AmplitudeRatio left, AmplitudeRatio right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(AmplitudeRatio left, AmplitudeRatio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(AmplitudeRatio left, AmplitudeRatio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Angle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Angle.NetFramework.g.cs index 1f5b396263..f649bc1734 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Angle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Angle.NetFramework.g.cs @@ -59,5 +59,205 @@ public partial struct Angle : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Angle from nullable Arcminutes. + /// + public static Angle? FromArcminutes(QuantityValue? arcminutes) + { + return arcminutes.HasValue ? FromArcminutes(arcminutes.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Arcseconds. + /// + public static Angle? FromArcseconds(QuantityValue? arcseconds) + { + return arcseconds.HasValue ? FromArcseconds(arcseconds.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Centiradians. + /// + public static Angle? FromCentiradians(QuantityValue? centiradians) + { + return centiradians.HasValue ? FromCentiradians(centiradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Deciradians. + /// + public static Angle? FromDeciradians(QuantityValue? deciradians) + { + return deciradians.HasValue ? FromDeciradians(deciradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Degrees. + /// + public static Angle? FromDegrees(QuantityValue? degrees) + { + return degrees.HasValue ? FromDegrees(degrees.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Gradians. + /// + public static Angle? FromGradians(QuantityValue? gradians) + { + return gradians.HasValue ? FromGradians(gradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Microdegrees. + /// + public static Angle? FromMicrodegrees(QuantityValue? microdegrees) + { + return microdegrees.HasValue ? FromMicrodegrees(microdegrees.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Microradians. + /// + public static Angle? FromMicroradians(QuantityValue? microradians) + { + return microradians.HasValue ? FromMicroradians(microradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Millidegrees. + /// + public static Angle? FromMillidegrees(QuantityValue? millidegrees) + { + return millidegrees.HasValue ? FromMillidegrees(millidegrees.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Milliradians. + /// + public static Angle? FromMilliradians(QuantityValue? milliradians) + { + return milliradians.HasValue ? FromMilliradians(milliradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Nanodegrees. + /// + public static Angle? FromNanodegrees(QuantityValue? nanodegrees) + { + return nanodegrees.HasValue ? FromNanodegrees(nanodegrees.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Nanoradians. + /// + public static Angle? FromNanoradians(QuantityValue? nanoradians) + { + return nanoradians.HasValue ? FromNanoradians(nanoradians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Radians. + /// + public static Angle? FromRadians(QuantityValue? radians) + { + return radians.HasValue ? FromRadians(radians.Value) : default(Angle?); + } + + /// + /// Get nullable Angle from nullable Revolutions. + /// + public static Angle? FromRevolutions(QuantityValue? revolutions) + { + return revolutions.HasValue ? FromRevolutions(revolutions.Value) : default(Angle?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Angle unit value. + public static Angle? From(QuantityValue? value, AngleUnit fromUnit) + { + return value.HasValue ? new Angle((double)value.Value, fromUnit) : default(Angle?); + } + + #endregion + + #region Arithmetic Operators + + public static Angle operator -(Angle right) + { + return new Angle(-right.Value, right.Unit); + } + + public static Angle operator +(Angle left, Angle right) + { + return new Angle(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Angle operator -(Angle left, Angle right) + { + return new Angle(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Angle operator *(double left, Angle right) + { + return new Angle(left * right.Value, right.Unit); + } + + public static Angle operator *(Angle left, double right) + { + return new Angle(left.Value * right, left.Unit); + } + + public static Angle operator /(Angle left, double right) + { + return new Angle(left.Value / right, left.Unit); + } + + public static double operator /(Angle left, Angle right) + { + return left.Degrees / right.Degrees; + } + + #endregion + + public static bool operator <=(Angle left, Angle right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Angle left, Angle right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Angle left, Angle right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Angle left, Angle right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Angle left, Angle right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Angle left, Angle right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentEnergy.NetFramework.g.cs index 29aa2d468d..5b31333830 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentEnergy.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct ApparentEnergy : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ApparentEnergy from nullable KilovoltampereHours. + /// + public static ApparentEnergy? FromKilovoltampereHours(QuantityValue? kilovoltamperehours) + { + return kilovoltamperehours.HasValue ? FromKilovoltampereHours(kilovoltamperehours.Value) : default(ApparentEnergy?); + } + + /// + /// Get nullable ApparentEnergy from nullable MegavoltampereHours. + /// + public static ApparentEnergy? FromMegavoltampereHours(QuantityValue? megavoltamperehours) + { + return megavoltamperehours.HasValue ? FromMegavoltampereHours(megavoltamperehours.Value) : default(ApparentEnergy?); + } + + /// + /// Get nullable ApparentEnergy from nullable VoltampereHours. + /// + public static ApparentEnergy? FromVoltampereHours(QuantityValue? voltamperehours) + { + return voltamperehours.HasValue ? FromVoltampereHours(voltamperehours.Value) : default(ApparentEnergy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ApparentEnergy unit value. + public static ApparentEnergy? From(QuantityValue? value, ApparentEnergyUnit fromUnit) + { + return value.HasValue ? new ApparentEnergy((double)value.Value, fromUnit) : default(ApparentEnergy?); + } + + #endregion + + #region Arithmetic Operators + + public static ApparentEnergy operator -(ApparentEnergy right) + { + return new ApparentEnergy(-right.Value, right.Unit); + } + + public static ApparentEnergy operator +(ApparentEnergy left, ApparentEnergy right) + { + return new ApparentEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ApparentEnergy operator -(ApparentEnergy left, ApparentEnergy right) + { + return new ApparentEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ApparentEnergy operator *(double left, ApparentEnergy right) + { + return new ApparentEnergy(left * right.Value, right.Unit); + } + + public static ApparentEnergy operator *(ApparentEnergy left, double right) + { + return new ApparentEnergy(left.Value * right, left.Unit); + } + + public static ApparentEnergy operator /(ApparentEnergy left, double right) + { + return new ApparentEnergy(left.Value / right, left.Unit); + } + + public static double operator /(ApparentEnergy left, ApparentEnergy right) + { + return left.VoltampereHours / right.VoltampereHours; + } + + #endregion + + public static bool operator <=(ApparentEnergy left, ApparentEnergy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ApparentEnergy left, ApparentEnergy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ApparentEnergy left, ApparentEnergy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ApparentEnergy left, ApparentEnergy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ApparentEnergy left, ApparentEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ApparentEnergy left, ApparentEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentPower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentPower.NetFramework.g.cs index a9fc5adb16..d6e6ffb409 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentPower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ApparentPower.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct ApparentPower : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ApparentPower from nullable Gigavoltamperes. + /// + public static ApparentPower? FromGigavoltamperes(QuantityValue? gigavoltamperes) + { + return gigavoltamperes.HasValue ? FromGigavoltamperes(gigavoltamperes.Value) : default(ApparentPower?); + } + + /// + /// Get nullable ApparentPower from nullable Kilovoltamperes. + /// + public static ApparentPower? FromKilovoltamperes(QuantityValue? kilovoltamperes) + { + return kilovoltamperes.HasValue ? FromKilovoltamperes(kilovoltamperes.Value) : default(ApparentPower?); + } + + /// + /// Get nullable ApparentPower from nullable Megavoltamperes. + /// + public static ApparentPower? FromMegavoltamperes(QuantityValue? megavoltamperes) + { + return megavoltamperes.HasValue ? FromMegavoltamperes(megavoltamperes.Value) : default(ApparentPower?); + } + + /// + /// Get nullable ApparentPower from nullable Voltamperes. + /// + public static ApparentPower? FromVoltamperes(QuantityValue? voltamperes) + { + return voltamperes.HasValue ? FromVoltamperes(voltamperes.Value) : default(ApparentPower?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ApparentPower unit value. + public static ApparentPower? From(QuantityValue? value, ApparentPowerUnit fromUnit) + { + return value.HasValue ? new ApparentPower((double)value.Value, fromUnit) : default(ApparentPower?); + } + + #endregion + + #region Arithmetic Operators + + public static ApparentPower operator -(ApparentPower right) + { + return new ApparentPower(-right.Value, right.Unit); + } + + public static ApparentPower operator +(ApparentPower left, ApparentPower right) + { + return new ApparentPower(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ApparentPower operator -(ApparentPower left, ApparentPower right) + { + return new ApparentPower(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ApparentPower operator *(double left, ApparentPower right) + { + return new ApparentPower(left * right.Value, right.Unit); + } + + public static ApparentPower operator *(ApparentPower left, double right) + { + return new ApparentPower(left.Value * right, left.Unit); + } + + public static ApparentPower operator /(ApparentPower left, double right) + { + return new ApparentPower(left.Value / right, left.Unit); + } + + public static double operator /(ApparentPower left, ApparentPower right) + { + return left.Voltamperes / right.Voltamperes; + } + + #endregion + + public static bool operator <=(ApparentPower left, ApparentPower right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ApparentPower left, ApparentPower right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ApparentPower left, ApparentPower right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ApparentPower left, ApparentPower right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ApparentPower left, ApparentPower right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ApparentPower left, ApparentPower right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Area.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Area.NetFramework.g.cs index 88d198ef93..3d3d0928be 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Area.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Area.NetFramework.g.cs @@ -59,5 +59,197 @@ public partial struct Area : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Area from nullable Acres. + /// + public static Area? FromAcres(QuantityValue? acres) + { + return acres.HasValue ? FromAcres(acres.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable Hectares. + /// + public static Area? FromHectares(QuantityValue? hectares) + { + return hectares.HasValue ? FromHectares(hectares.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareCentimeters. + /// + public static Area? FromSquareCentimeters(QuantityValue? squarecentimeters) + { + return squarecentimeters.HasValue ? FromSquareCentimeters(squarecentimeters.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareDecimeters. + /// + public static Area? FromSquareDecimeters(QuantityValue? squaredecimeters) + { + return squaredecimeters.HasValue ? FromSquareDecimeters(squaredecimeters.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareFeet. + /// + public static Area? FromSquareFeet(QuantityValue? squarefeet) + { + return squarefeet.HasValue ? FromSquareFeet(squarefeet.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareInches. + /// + public static Area? FromSquareInches(QuantityValue? squareinches) + { + return squareinches.HasValue ? FromSquareInches(squareinches.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareKilometers. + /// + public static Area? FromSquareKilometers(QuantityValue? squarekilometers) + { + return squarekilometers.HasValue ? FromSquareKilometers(squarekilometers.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareMeters. + /// + public static Area? FromSquareMeters(QuantityValue? squaremeters) + { + return squaremeters.HasValue ? FromSquareMeters(squaremeters.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareMicrometers. + /// + public static Area? FromSquareMicrometers(QuantityValue? squaremicrometers) + { + return squaremicrometers.HasValue ? FromSquareMicrometers(squaremicrometers.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareMiles. + /// + public static Area? FromSquareMiles(QuantityValue? squaremiles) + { + return squaremiles.HasValue ? FromSquareMiles(squaremiles.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareMillimeters. + /// + public static Area? FromSquareMillimeters(QuantityValue? squaremillimeters) + { + return squaremillimeters.HasValue ? FromSquareMillimeters(squaremillimeters.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable SquareYards. + /// + public static Area? FromSquareYards(QuantityValue? squareyards) + { + return squareyards.HasValue ? FromSquareYards(squareyards.Value) : default(Area?); + } + + /// + /// Get nullable Area from nullable UsSurveySquareFeet. + /// + public static Area? FromUsSurveySquareFeet(QuantityValue? ussurveysquarefeet) + { + return ussurveysquarefeet.HasValue ? FromUsSurveySquareFeet(ussurveysquarefeet.Value) : default(Area?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Area unit value. + public static Area? From(QuantityValue? value, AreaUnit fromUnit) + { + return value.HasValue ? new Area((double)value.Value, fromUnit) : default(Area?); + } + + #endregion + + #region Arithmetic Operators + + public static Area operator -(Area right) + { + return new Area(-right.Value, right.Unit); + } + + public static Area operator +(Area left, Area right) + { + return new Area(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Area operator -(Area left, Area right) + { + return new Area(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Area operator *(double left, Area right) + { + return new Area(left * right.Value, right.Unit); + } + + public static Area operator *(Area left, double right) + { + return new Area(left.Value * right, left.Unit); + } + + public static Area operator /(Area left, double right) + { + return new Area(left.Value / right, left.Unit); + } + + public static double operator /(Area left, Area right) + { + return left.SquareMeters / right.SquareMeters; + } + + #endregion + + public static bool operator <=(Area left, Area right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Area left, Area right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Area left, Area right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Area left, Area right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Area left, Area right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Area left, Area right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaDensity.NetFramework.g.cs index 44c92dcffc..4ed29aa16a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaDensity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct AreaDensity : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable AreaDensity from nullable KilogramsPerSquareMeter. + /// + public static AreaDensity? FromKilogramsPerSquareMeter(QuantityValue? kilogramspersquaremeter) + { + return kilogramspersquaremeter.HasValue ? FromKilogramsPerSquareMeter(kilogramspersquaremeter.Value) : default(AreaDensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AreaDensity unit value. + public static AreaDensity? From(QuantityValue? value, AreaDensityUnit fromUnit) + { + return value.HasValue ? new AreaDensity((double)value.Value, fromUnit) : default(AreaDensity?); + } + + #endregion + + #region Arithmetic Operators + + public static AreaDensity operator -(AreaDensity right) + { + return new AreaDensity(-right.Value, right.Unit); + } + + public static AreaDensity operator +(AreaDensity left, AreaDensity right) + { + return new AreaDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AreaDensity operator -(AreaDensity left, AreaDensity right) + { + return new AreaDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AreaDensity operator *(double left, AreaDensity right) + { + return new AreaDensity(left * right.Value, right.Unit); + } + + public static AreaDensity operator *(AreaDensity left, double right) + { + return new AreaDensity(left.Value * right, left.Unit); + } + + public static AreaDensity operator /(AreaDensity left, double right) + { + return new AreaDensity(left.Value / right, left.Unit); + } + + public static double operator /(AreaDensity left, AreaDensity right) + { + return left.KilogramsPerSquareMeter / right.KilogramsPerSquareMeter; + } + + #endregion + + public static bool operator <=(AreaDensity left, AreaDensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(AreaDensity left, AreaDensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(AreaDensity left, AreaDensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(AreaDensity left, AreaDensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(AreaDensity left, AreaDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(AreaDensity left, AreaDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaMomentOfInertia.NetFramework.g.cs index bd73011b9b..557a18fbc3 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/AreaMomentOfInertia.NetFramework.g.cs @@ -59,5 +59,141 @@ public partial struct AreaMomentOfInertia : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable AreaMomentOfInertia from nullable CentimetersToTheFourth. + /// + public static AreaMomentOfInertia? FromCentimetersToTheFourth(QuantityValue? centimeterstothefourth) + { + return centimeterstothefourth.HasValue ? FromCentimetersToTheFourth(centimeterstothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Get nullable AreaMomentOfInertia from nullable DecimetersToTheFourth. + /// + public static AreaMomentOfInertia? FromDecimetersToTheFourth(QuantityValue? decimeterstothefourth) + { + return decimeterstothefourth.HasValue ? FromDecimetersToTheFourth(decimeterstothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Get nullable AreaMomentOfInertia from nullable FeetToTheFourth. + /// + public static AreaMomentOfInertia? FromFeetToTheFourth(QuantityValue? feettothefourth) + { + return feettothefourth.HasValue ? FromFeetToTheFourth(feettothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Get nullable AreaMomentOfInertia from nullable InchesToTheFourth. + /// + public static AreaMomentOfInertia? FromInchesToTheFourth(QuantityValue? inchestothefourth) + { + return inchestothefourth.HasValue ? FromInchesToTheFourth(inchestothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Get nullable AreaMomentOfInertia from nullable MetersToTheFourth. + /// + public static AreaMomentOfInertia? FromMetersToTheFourth(QuantityValue? meterstothefourth) + { + return meterstothefourth.HasValue ? FromMetersToTheFourth(meterstothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Get nullable AreaMomentOfInertia from nullable MillimetersToTheFourth. + /// + public static AreaMomentOfInertia? FromMillimetersToTheFourth(QuantityValue? millimeterstothefourth) + { + return millimeterstothefourth.HasValue ? FromMillimetersToTheFourth(millimeterstothefourth.Value) : default(AreaMomentOfInertia?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// AreaMomentOfInertia unit value. + public static AreaMomentOfInertia? From(QuantityValue? value, AreaMomentOfInertiaUnit fromUnit) + { + return value.HasValue ? new AreaMomentOfInertia((double)value.Value, fromUnit) : default(AreaMomentOfInertia?); + } + + #endregion + + #region Arithmetic Operators + + public static AreaMomentOfInertia operator -(AreaMomentOfInertia right) + { + return new AreaMomentOfInertia(-right.Value, right.Unit); + } + + public static AreaMomentOfInertia operator +(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return new AreaMomentOfInertia(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AreaMomentOfInertia operator -(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return new AreaMomentOfInertia(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static AreaMomentOfInertia operator *(double left, AreaMomentOfInertia right) + { + return new AreaMomentOfInertia(left * right.Value, right.Unit); + } + + public static AreaMomentOfInertia operator *(AreaMomentOfInertia left, double right) + { + return new AreaMomentOfInertia(left.Value * right, left.Unit); + } + + public static AreaMomentOfInertia operator /(AreaMomentOfInertia left, double right) + { + return new AreaMomentOfInertia(left.Value / right, left.Unit); + } + + public static double operator /(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.MetersToTheFourth / right.MetersToTheFourth; + } + + #endregion + + public static bool operator <=(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(AreaMomentOfInertia left, AreaMomentOfInertia right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/BitRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/BitRate.NetFramework.g.cs index d532bedf32..ce2de7e00d 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/BitRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/BitRate.NetFramework.g.cs @@ -59,5 +59,299 @@ public partial struct BitRate : IComparable, IComparable /// The numeric value this quantity was constructed with. /// public decimal Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable BitRate from nullable BitsPerSecond. + /// + public static BitRate? FromBitsPerSecond(QuantityValue? bitspersecond) + { + return bitspersecond.HasValue ? FromBitsPerSecond(bitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable BytesPerSecond. + /// + public static BitRate? FromBytesPerSecond(QuantityValue? bytespersecond) + { + return bytespersecond.HasValue ? FromBytesPerSecond(bytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable ExabitsPerSecond. + /// + public static BitRate? FromExabitsPerSecond(QuantityValue? exabitspersecond) + { + return exabitspersecond.HasValue ? FromExabitsPerSecond(exabitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable ExabytesPerSecond. + /// + public static BitRate? FromExabytesPerSecond(QuantityValue? exabytespersecond) + { + return exabytespersecond.HasValue ? FromExabytesPerSecond(exabytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable ExbibitsPerSecond. + /// + public static BitRate? FromExbibitsPerSecond(QuantityValue? exbibitspersecond) + { + return exbibitspersecond.HasValue ? FromExbibitsPerSecond(exbibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable ExbibytesPerSecond. + /// + public static BitRate? FromExbibytesPerSecond(QuantityValue? exbibytespersecond) + { + return exbibytespersecond.HasValue ? FromExbibytesPerSecond(exbibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable GibibitsPerSecond. + /// + public static BitRate? FromGibibitsPerSecond(QuantityValue? gibibitspersecond) + { + return gibibitspersecond.HasValue ? FromGibibitsPerSecond(gibibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable GibibytesPerSecond. + /// + public static BitRate? FromGibibytesPerSecond(QuantityValue? gibibytespersecond) + { + return gibibytespersecond.HasValue ? FromGibibytesPerSecond(gibibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable GigabitsPerSecond. + /// + public static BitRate? FromGigabitsPerSecond(QuantityValue? gigabitspersecond) + { + return gigabitspersecond.HasValue ? FromGigabitsPerSecond(gigabitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable GigabytesPerSecond. + /// + public static BitRate? FromGigabytesPerSecond(QuantityValue? gigabytespersecond) + { + return gigabytespersecond.HasValue ? FromGigabytesPerSecond(gigabytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable KibibitsPerSecond. + /// + public static BitRate? FromKibibitsPerSecond(QuantityValue? kibibitspersecond) + { + return kibibitspersecond.HasValue ? FromKibibitsPerSecond(kibibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable KibibytesPerSecond. + /// + public static BitRate? FromKibibytesPerSecond(QuantityValue? kibibytespersecond) + { + return kibibytespersecond.HasValue ? FromKibibytesPerSecond(kibibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable KilobitsPerSecond. + /// + public static BitRate? FromKilobitsPerSecond(QuantityValue? kilobitspersecond) + { + return kilobitspersecond.HasValue ? FromKilobitsPerSecond(kilobitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable KilobytesPerSecond. + /// + public static BitRate? FromKilobytesPerSecond(QuantityValue? kilobytespersecond) + { + return kilobytespersecond.HasValue ? FromKilobytesPerSecond(kilobytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable MebibitsPerSecond. + /// + public static BitRate? FromMebibitsPerSecond(QuantityValue? mebibitspersecond) + { + return mebibitspersecond.HasValue ? FromMebibitsPerSecond(mebibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable MebibytesPerSecond. + /// + public static BitRate? FromMebibytesPerSecond(QuantityValue? mebibytespersecond) + { + return mebibytespersecond.HasValue ? FromMebibytesPerSecond(mebibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable MegabitsPerSecond. + /// + public static BitRate? FromMegabitsPerSecond(QuantityValue? megabitspersecond) + { + return megabitspersecond.HasValue ? FromMegabitsPerSecond(megabitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable MegabytesPerSecond. + /// + public static BitRate? FromMegabytesPerSecond(QuantityValue? megabytespersecond) + { + return megabytespersecond.HasValue ? FromMegabytesPerSecond(megabytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable PebibitsPerSecond. + /// + public static BitRate? FromPebibitsPerSecond(QuantityValue? pebibitspersecond) + { + return pebibitspersecond.HasValue ? FromPebibitsPerSecond(pebibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable PebibytesPerSecond. + /// + public static BitRate? FromPebibytesPerSecond(QuantityValue? pebibytespersecond) + { + return pebibytespersecond.HasValue ? FromPebibytesPerSecond(pebibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable PetabitsPerSecond. + /// + public static BitRate? FromPetabitsPerSecond(QuantityValue? petabitspersecond) + { + return petabitspersecond.HasValue ? FromPetabitsPerSecond(petabitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable PetabytesPerSecond. + /// + public static BitRate? FromPetabytesPerSecond(QuantityValue? petabytespersecond) + { + return petabytespersecond.HasValue ? FromPetabytesPerSecond(petabytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable TebibitsPerSecond. + /// + public static BitRate? FromTebibitsPerSecond(QuantityValue? tebibitspersecond) + { + return tebibitspersecond.HasValue ? FromTebibitsPerSecond(tebibitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable TebibytesPerSecond. + /// + public static BitRate? FromTebibytesPerSecond(QuantityValue? tebibytespersecond) + { + return tebibytespersecond.HasValue ? FromTebibytesPerSecond(tebibytespersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable TerabitsPerSecond. + /// + public static BitRate? FromTerabitsPerSecond(QuantityValue? terabitspersecond) + { + return terabitspersecond.HasValue ? FromTerabitsPerSecond(terabitspersecond.Value) : default(BitRate?); + } + + /// + /// Get nullable BitRate from nullable TerabytesPerSecond. + /// + public static BitRate? FromTerabytesPerSecond(QuantityValue? terabytespersecond) + { + return terabytespersecond.HasValue ? FromTerabytesPerSecond(terabytespersecond.Value) : default(BitRate?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// BitRate unit value. + public static BitRate? From(QuantityValue? value, BitRateUnit fromUnit) + { + return value.HasValue ? new BitRate((decimal)value.Value, fromUnit) : default(BitRate?); + } + + #endregion + + #region Arithmetic Operators + + public static BitRate operator -(BitRate right) + { + return new BitRate(-right.Value, right.Unit); + } + + public static BitRate operator +(BitRate left, BitRate right) + { + return new BitRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static BitRate operator -(BitRate left, BitRate right) + { + return new BitRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static BitRate operator *(decimal left, BitRate right) + { + return new BitRate(left * right.Value, right.Unit); + } + + public static BitRate operator *(BitRate left, decimal right) + { + return new BitRate(left.Value * right, left.Unit); + } + + public static BitRate operator /(BitRate left, decimal right) + { + return new BitRate(left.Value / right, left.Unit); + } + + public static double operator /(BitRate left, BitRate right) + { + return left.BitsPerSecond / right.BitsPerSecond; + } + + #endregion + + public static bool operator <=(BitRate left, BitRate right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(BitRate left, BitRate right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(BitRate left, BitRate right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(BitRate left, BitRate right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + public static bool operator ==(BitRate left, BitRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + public static bool operator !=(BitRate left, BitRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/BrakeSpecificFuelConsumption.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/BrakeSpecificFuelConsumption.NetFramework.g.cs index 106fd55310..b14934315a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/BrakeSpecificFuelConsumption.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/BrakeSpecificFuelConsumption.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct BrakeSpecificFuelConsumption : IComparable, IComparable
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable BrakeSpecificFuelConsumption from nullable GramsPerKiloWattHour. + /// + public static BrakeSpecificFuelConsumption? FromGramsPerKiloWattHour(QuantityValue? gramsperkilowatthour) + { + return gramsperkilowatthour.HasValue ? FromGramsPerKiloWattHour(gramsperkilowatthour.Value) : default(BrakeSpecificFuelConsumption?); + } + + /// + /// Get nullable BrakeSpecificFuelConsumption from nullable KilogramsPerJoule. + /// + public static BrakeSpecificFuelConsumption? FromKilogramsPerJoule(QuantityValue? kilogramsperjoule) + { + return kilogramsperjoule.HasValue ? FromKilogramsPerJoule(kilogramsperjoule.Value) : default(BrakeSpecificFuelConsumption?); + } + + /// + /// Get nullable BrakeSpecificFuelConsumption from nullable PoundsPerMechanicalHorsepowerHour. + /// + public static BrakeSpecificFuelConsumption? FromPoundsPerMechanicalHorsepowerHour(QuantityValue? poundspermechanicalhorsepowerhour) + { + return poundspermechanicalhorsepowerhour.HasValue ? FromPoundsPerMechanicalHorsepowerHour(poundspermechanicalhorsepowerhour.Value) : default(BrakeSpecificFuelConsumption?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// BrakeSpecificFuelConsumption unit value. + public static BrakeSpecificFuelConsumption? From(QuantityValue? value, BrakeSpecificFuelConsumptionUnit fromUnit) + { + return value.HasValue ? new BrakeSpecificFuelConsumption((double)value.Value, fromUnit) : default(BrakeSpecificFuelConsumption?); + } + + #endregion + + #region Arithmetic Operators + + public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption right) + { + return new BrakeSpecificFuelConsumption(-right.Value, right.Unit); + } + + public static BrakeSpecificFuelConsumption operator +(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return new BrakeSpecificFuelConsumption(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static BrakeSpecificFuelConsumption operator -(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return new BrakeSpecificFuelConsumption(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static BrakeSpecificFuelConsumption operator *(double left, BrakeSpecificFuelConsumption right) + { + return new BrakeSpecificFuelConsumption(left * right.Value, right.Unit); + } + + public static BrakeSpecificFuelConsumption operator *(BrakeSpecificFuelConsumption left, double right) + { + return new BrakeSpecificFuelConsumption(left.Value * right, left.Unit); + } + + public static BrakeSpecificFuelConsumption operator /(BrakeSpecificFuelConsumption left, double right) + { + return new BrakeSpecificFuelConsumption(left.Value / right, left.Unit); + } + + public static double operator /(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.KilogramsPerJoule / right.KilogramsPerJoule; + } + + #endregion + + public static bool operator <=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(BrakeSpecificFuelConsumption left, BrakeSpecificFuelConsumption right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Capacitance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Capacitance.NetFramework.g.cs index 29c3287173..a2e0f5b784 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Capacitance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Capacitance.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct Capacitance : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Capacitance from nullable Farads. + /// + public static Capacitance? FromFarads(QuantityValue? farads) + { + return farads.HasValue ? FromFarads(farads.Value) : default(Capacitance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Capacitance unit value. + public static Capacitance? From(QuantityValue? value, CapacitanceUnit fromUnit) + { + return value.HasValue ? new Capacitance((double)value.Value, fromUnit) : default(Capacitance?); + } + + #endregion + + #region Arithmetic Operators + + public static Capacitance operator -(Capacitance right) + { + return new Capacitance(-right.Value, right.Unit); + } + + public static Capacitance operator +(Capacitance left, Capacitance right) + { + return new Capacitance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Capacitance operator -(Capacitance left, Capacitance right) + { + return new Capacitance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Capacitance operator *(double left, Capacitance right) + { + return new Capacitance(left * right.Value, right.Unit); + } + + public static Capacitance operator *(Capacitance left, double right) + { + return new Capacitance(left.Value * right, left.Unit); + } + + public static Capacitance operator /(Capacitance left, double right) + { + return new Capacitance(left.Value / right, left.Unit); + } + + public static double operator /(Capacitance left, Capacitance right) + { + return left.Farads / right.Farads; + } + + #endregion + + public static bool operator <=(Capacitance left, Capacitance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Capacitance left, Capacitance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Capacitance left, Capacitance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Capacitance left, Capacitance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Capacitance left, Capacitance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Capacitance left, Capacitance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Density.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Density.NetFramework.g.cs index 37d0c587b6..9cd80b7760 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Density.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Density.NetFramework.g.cs @@ -59,5 +59,397 @@ public partial struct Density : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Density from nullable CentigramsPerDeciLiter. + /// + public static Density? FromCentigramsPerDeciLiter(QuantityValue? centigramsperdeciliter) + { + return centigramsperdeciliter.HasValue ? FromCentigramsPerDeciLiter(centigramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable CentigramsPerLiter. + /// + public static Density? FromCentigramsPerLiter(QuantityValue? centigramsperliter) + { + return centigramsperliter.HasValue ? FromCentigramsPerLiter(centigramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable CentigramsPerMilliliter. + /// + public static Density? FromCentigramsPerMilliliter(QuantityValue? centigramspermilliliter) + { + return centigramspermilliliter.HasValue ? FromCentigramsPerMilliliter(centigramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable DecigramsPerDeciLiter. + /// + public static Density? FromDecigramsPerDeciLiter(QuantityValue? decigramsperdeciliter) + { + return decigramsperdeciliter.HasValue ? FromDecigramsPerDeciLiter(decigramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable DecigramsPerLiter. + /// + public static Density? FromDecigramsPerLiter(QuantityValue? decigramsperliter) + { + return decigramsperliter.HasValue ? FromDecigramsPerLiter(decigramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable DecigramsPerMilliliter. + /// + public static Density? FromDecigramsPerMilliliter(QuantityValue? decigramspermilliliter) + { + return decigramspermilliliter.HasValue ? FromDecigramsPerMilliliter(decigramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerCubicCentimeter. + /// + public static Density? FromGramsPerCubicCentimeter(QuantityValue? gramspercubiccentimeter) + { + return gramspercubiccentimeter.HasValue ? FromGramsPerCubicCentimeter(gramspercubiccentimeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerCubicMeter. + /// + public static Density? FromGramsPerCubicMeter(QuantityValue? gramspercubicmeter) + { + return gramspercubicmeter.HasValue ? FromGramsPerCubicMeter(gramspercubicmeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerCubicMillimeter. + /// + public static Density? FromGramsPerCubicMillimeter(QuantityValue? gramspercubicmillimeter) + { + return gramspercubicmillimeter.HasValue ? FromGramsPerCubicMillimeter(gramspercubicmillimeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerDeciLiter. + /// + public static Density? FromGramsPerDeciLiter(QuantityValue? gramsperdeciliter) + { + return gramsperdeciliter.HasValue ? FromGramsPerDeciLiter(gramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerLiter. + /// + public static Density? FromGramsPerLiter(QuantityValue? gramsperliter) + { + return gramsperliter.HasValue ? FromGramsPerLiter(gramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable GramsPerMilliliter. + /// + public static Density? FromGramsPerMilliliter(QuantityValue? gramspermilliliter) + { + return gramspermilliliter.HasValue ? FromGramsPerMilliliter(gramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable KilogramsPerCubicCentimeter. + /// + public static Density? FromKilogramsPerCubicCentimeter(QuantityValue? kilogramspercubiccentimeter) + { + return kilogramspercubiccentimeter.HasValue ? FromKilogramsPerCubicCentimeter(kilogramspercubiccentimeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable KilogramsPerCubicMeter. + /// + public static Density? FromKilogramsPerCubicMeter(QuantityValue? kilogramspercubicmeter) + { + return kilogramspercubicmeter.HasValue ? FromKilogramsPerCubicMeter(kilogramspercubicmeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable KilogramsPerCubicMillimeter. + /// + public static Density? FromKilogramsPerCubicMillimeter(QuantityValue? kilogramspercubicmillimeter) + { + return kilogramspercubicmillimeter.HasValue ? FromKilogramsPerCubicMillimeter(kilogramspercubicmillimeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable KilopoundsPerCubicFoot. + /// + public static Density? FromKilopoundsPerCubicFoot(QuantityValue? kilopoundspercubicfoot) + { + return kilopoundspercubicfoot.HasValue ? FromKilopoundsPerCubicFoot(kilopoundspercubicfoot.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable KilopoundsPerCubicInch. + /// + public static Density? FromKilopoundsPerCubicInch(QuantityValue? kilopoundspercubicinch) + { + return kilopoundspercubicinch.HasValue ? FromKilopoundsPerCubicInch(kilopoundspercubicinch.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MicrogramsPerDeciLiter. + /// + public static Density? FromMicrogramsPerDeciLiter(QuantityValue? microgramsperdeciliter) + { + return microgramsperdeciliter.HasValue ? FromMicrogramsPerDeciLiter(microgramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MicrogramsPerLiter. + /// + public static Density? FromMicrogramsPerLiter(QuantityValue? microgramsperliter) + { + return microgramsperliter.HasValue ? FromMicrogramsPerLiter(microgramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MicrogramsPerMilliliter. + /// + public static Density? FromMicrogramsPerMilliliter(QuantityValue? microgramspermilliliter) + { + return microgramspermilliliter.HasValue ? FromMicrogramsPerMilliliter(microgramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MilligramsPerCubicMeter. + /// + public static Density? FromMilligramsPerCubicMeter(QuantityValue? milligramspercubicmeter) + { + return milligramspercubicmeter.HasValue ? FromMilligramsPerCubicMeter(milligramspercubicmeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MilligramsPerDeciLiter. + /// + public static Density? FromMilligramsPerDeciLiter(QuantityValue? milligramsperdeciliter) + { + return milligramsperdeciliter.HasValue ? FromMilligramsPerDeciLiter(milligramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MilligramsPerLiter. + /// + public static Density? FromMilligramsPerLiter(QuantityValue? milligramsperliter) + { + return milligramsperliter.HasValue ? FromMilligramsPerLiter(milligramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable MilligramsPerMilliliter. + /// + public static Density? FromMilligramsPerMilliliter(QuantityValue? milligramspermilliliter) + { + return milligramspermilliliter.HasValue ? FromMilligramsPerMilliliter(milligramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable NanogramsPerDeciLiter. + /// + public static Density? FromNanogramsPerDeciLiter(QuantityValue? nanogramsperdeciliter) + { + return nanogramsperdeciliter.HasValue ? FromNanogramsPerDeciLiter(nanogramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable NanogramsPerLiter. + /// + public static Density? FromNanogramsPerLiter(QuantityValue? nanogramsperliter) + { + return nanogramsperliter.HasValue ? FromNanogramsPerLiter(nanogramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable NanogramsPerMilliliter. + /// + public static Density? FromNanogramsPerMilliliter(QuantityValue? nanogramspermilliliter) + { + return nanogramspermilliliter.HasValue ? FromNanogramsPerMilliliter(nanogramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PicogramsPerDeciLiter. + /// + public static Density? FromPicogramsPerDeciLiter(QuantityValue? picogramsperdeciliter) + { + return picogramsperdeciliter.HasValue ? FromPicogramsPerDeciLiter(picogramsperdeciliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PicogramsPerLiter. + /// + public static Density? FromPicogramsPerLiter(QuantityValue? picogramsperliter) + { + return picogramsperliter.HasValue ? FromPicogramsPerLiter(picogramsperliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PicogramsPerMilliliter. + /// + public static Density? FromPicogramsPerMilliliter(QuantityValue? picogramspermilliliter) + { + return picogramspermilliliter.HasValue ? FromPicogramsPerMilliliter(picogramspermilliliter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PoundsPerCubicFoot. + /// + public static Density? FromPoundsPerCubicFoot(QuantityValue? poundspercubicfoot) + { + return poundspercubicfoot.HasValue ? FromPoundsPerCubicFoot(poundspercubicfoot.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PoundsPerCubicInch. + /// + public static Density? FromPoundsPerCubicInch(QuantityValue? poundspercubicinch) + { + return poundspercubicinch.HasValue ? FromPoundsPerCubicInch(poundspercubicinch.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PoundsPerImperialGallon. + /// + public static Density? FromPoundsPerImperialGallon(QuantityValue? poundsperimperialgallon) + { + return poundsperimperialgallon.HasValue ? FromPoundsPerImperialGallon(poundsperimperialgallon.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable PoundsPerUSGallon. + /// + public static Density? FromPoundsPerUSGallon(QuantityValue? poundsperusgallon) + { + return poundsperusgallon.HasValue ? FromPoundsPerUSGallon(poundsperusgallon.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable SlugsPerCubicFoot. + /// + public static Density? FromSlugsPerCubicFoot(QuantityValue? slugspercubicfoot) + { + return slugspercubicfoot.HasValue ? FromSlugsPerCubicFoot(slugspercubicfoot.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable TonnesPerCubicCentimeter. + /// + public static Density? FromTonnesPerCubicCentimeter(QuantityValue? tonnespercubiccentimeter) + { + return tonnespercubiccentimeter.HasValue ? FromTonnesPerCubicCentimeter(tonnespercubiccentimeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable TonnesPerCubicMeter. + /// + public static Density? FromTonnesPerCubicMeter(QuantityValue? tonnespercubicmeter) + { + return tonnespercubicmeter.HasValue ? FromTonnesPerCubicMeter(tonnespercubicmeter.Value) : default(Density?); + } + + /// + /// Get nullable Density from nullable TonnesPerCubicMillimeter. + /// + public static Density? FromTonnesPerCubicMillimeter(QuantityValue? tonnespercubicmillimeter) + { + return tonnespercubicmillimeter.HasValue ? FromTonnesPerCubicMillimeter(tonnespercubicmillimeter.Value) : default(Density?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Density unit value. + public static Density? From(QuantityValue? value, DensityUnit fromUnit) + { + return value.HasValue ? new Density((double)value.Value, fromUnit) : default(Density?); + } + + #endregion + + #region Arithmetic Operators + + public static Density operator -(Density right) + { + return new Density(-right.Value, right.Unit); + } + + public static Density operator +(Density left, Density right) + { + return new Density(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Density operator -(Density left, Density right) + { + return new Density(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Density operator *(double left, Density right) + { + return new Density(left * right.Value, right.Unit); + } + + public static Density operator *(Density left, double right) + { + return new Density(left.Value * right, left.Unit); + } + + public static Density operator /(Density left, double right) + { + return new Density(left.Value / right, left.Unit); + } + + public static double operator /(Density left, Density right) + { + return left.KilogramsPerCubicMeter / right.KilogramsPerCubicMeter; + } + + #endregion + + public static bool operator <=(Density left, Density right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Density left, Density right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Density left, Density right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Density left, Density right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Density left, Density right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Density left, Density right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Duration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Duration.NetFramework.g.cs index 816ada1041..c9ffab6744 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Duration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Duration.NetFramework.g.cs @@ -59,5 +59,189 @@ public partial struct Duration : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Duration from nullable Days. + /// + public static Duration? FromDays(QuantityValue? days) + { + return days.HasValue ? FromDays(days.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Hours. + /// + public static Duration? FromHours(QuantityValue? hours) + { + return hours.HasValue ? FromHours(hours.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Microseconds. + /// + public static Duration? FromMicroseconds(QuantityValue? microseconds) + { + return microseconds.HasValue ? FromMicroseconds(microseconds.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Milliseconds. + /// + public static Duration? FromMilliseconds(QuantityValue? milliseconds) + { + return milliseconds.HasValue ? FromMilliseconds(milliseconds.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Minutes. + /// + public static Duration? FromMinutes(QuantityValue? minutes) + { + return minutes.HasValue ? FromMinutes(minutes.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Months. + /// + public static Duration? FromMonths(QuantityValue? months) + { + return months.HasValue ? FromMonths(months.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Months30. + /// + public static Duration? FromMonths30(QuantityValue? months30) + { + return months30.HasValue ? FromMonths30(months30.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Nanoseconds. + /// + public static Duration? FromNanoseconds(QuantityValue? nanoseconds) + { + return nanoseconds.HasValue ? FromNanoseconds(nanoseconds.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Seconds. + /// + public static Duration? FromSeconds(QuantityValue? seconds) + { + return seconds.HasValue ? FromSeconds(seconds.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Weeks. + /// + public static Duration? FromWeeks(QuantityValue? weeks) + { + return weeks.HasValue ? FromWeeks(weeks.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Years. + /// + public static Duration? FromYears(QuantityValue? years) + { + return years.HasValue ? FromYears(years.Value) : default(Duration?); + } + + /// + /// Get nullable Duration from nullable Years365. + /// + public static Duration? FromYears365(QuantityValue? years365) + { + return years365.HasValue ? FromYears365(years365.Value) : default(Duration?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Duration unit value. + public static Duration? From(QuantityValue? value, DurationUnit fromUnit) + { + return value.HasValue ? new Duration((double)value.Value, fromUnit) : default(Duration?); + } + + #endregion + + #region Arithmetic Operators + + public static Duration operator -(Duration right) + { + return new Duration(-right.Value, right.Unit); + } + + public static Duration operator +(Duration left, Duration right) + { + return new Duration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Duration operator -(Duration left, Duration right) + { + return new Duration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Duration operator *(double left, Duration right) + { + return new Duration(left * right.Value, right.Unit); + } + + public static Duration operator *(Duration left, double right) + { + return new Duration(left.Value * right, left.Unit); + } + + public static Duration operator /(Duration left, double right) + { + return new Duration(left.Value / right, left.Unit); + } + + public static double operator /(Duration left, Duration right) + { + return left.Seconds / right.Seconds; + } + + #endregion + + public static bool operator <=(Duration left, Duration right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Duration left, Duration right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Duration left, Duration right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Duration left, Duration right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Duration left, Duration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Duration left, Duration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/DynamicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/DynamicViscosity.NetFramework.g.cs index f6742681d9..482d8a999e 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/DynamicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/DynamicViscosity.NetFramework.g.cs @@ -59,5 +59,141 @@ public partial struct DynamicViscosity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable DynamicViscosity from nullable Centipoise. + /// + public static DynamicViscosity? FromCentipoise(QuantityValue? centipoise) + { + return centipoise.HasValue ? FromCentipoise(centipoise.Value) : default(DynamicViscosity?); + } + + /// + /// Get nullable DynamicViscosity from nullable MicropascalSeconds. + /// + public static DynamicViscosity? FromMicropascalSeconds(QuantityValue? micropascalseconds) + { + return micropascalseconds.HasValue ? FromMicropascalSeconds(micropascalseconds.Value) : default(DynamicViscosity?); + } + + /// + /// Get nullable DynamicViscosity from nullable MillipascalSeconds. + /// + public static DynamicViscosity? FromMillipascalSeconds(QuantityValue? millipascalseconds) + { + return millipascalseconds.HasValue ? FromMillipascalSeconds(millipascalseconds.Value) : default(DynamicViscosity?); + } + + /// + /// Get nullable DynamicViscosity from nullable NewtonSecondsPerMeterSquared. + /// + public static DynamicViscosity? FromNewtonSecondsPerMeterSquared(QuantityValue? newtonsecondspermetersquared) + { + return newtonsecondspermetersquared.HasValue ? FromNewtonSecondsPerMeterSquared(newtonsecondspermetersquared.Value) : default(DynamicViscosity?); + } + + /// + /// Get nullable DynamicViscosity from nullable PascalSeconds. + /// + public static DynamicViscosity? FromPascalSeconds(QuantityValue? pascalseconds) + { + return pascalseconds.HasValue ? FromPascalSeconds(pascalseconds.Value) : default(DynamicViscosity?); + } + + /// + /// Get nullable DynamicViscosity from nullable Poise. + /// + public static DynamicViscosity? FromPoise(QuantityValue? poise) + { + return poise.HasValue ? FromPoise(poise.Value) : default(DynamicViscosity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// DynamicViscosity unit value. + public static DynamicViscosity? From(QuantityValue? value, DynamicViscosityUnit fromUnit) + { + return value.HasValue ? new DynamicViscosity((double)value.Value, fromUnit) : default(DynamicViscosity?); + } + + #endregion + + #region Arithmetic Operators + + public static DynamicViscosity operator -(DynamicViscosity right) + { + return new DynamicViscosity(-right.Value, right.Unit); + } + + public static DynamicViscosity operator +(DynamicViscosity left, DynamicViscosity right) + { + return new DynamicViscosity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static DynamicViscosity operator -(DynamicViscosity left, DynamicViscosity right) + { + return new DynamicViscosity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static DynamicViscosity operator *(double left, DynamicViscosity right) + { + return new DynamicViscosity(left * right.Value, right.Unit); + } + + public static DynamicViscosity operator *(DynamicViscosity left, double right) + { + return new DynamicViscosity(left.Value * right, left.Unit); + } + + public static DynamicViscosity operator /(DynamicViscosity left, double right) + { + return new DynamicViscosity(left.Value / right, left.Unit); + } + + public static double operator /(DynamicViscosity left, DynamicViscosity right) + { + return left.NewtonSecondsPerMeterSquared / right.NewtonSecondsPerMeterSquared; + } + + #endregion + + public static bool operator <=(DynamicViscosity left, DynamicViscosity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(DynamicViscosity left, DynamicViscosity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(DynamicViscosity left, DynamicViscosity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(DynamicViscosity left, DynamicViscosity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(DynamicViscosity left, DynamicViscosity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(DynamicViscosity left, DynamicViscosity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricAdmittance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricAdmittance.NetFramework.g.cs index e7690606d9..023fdaafdd 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricAdmittance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricAdmittance.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct ElectricAdmittance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricAdmittance from nullable Microsiemens. + /// + public static ElectricAdmittance? FromMicrosiemens(QuantityValue? microsiemens) + { + return microsiemens.HasValue ? FromMicrosiemens(microsiemens.Value) : default(ElectricAdmittance?); + } + + /// + /// Get nullable ElectricAdmittance from nullable Millisiemens. + /// + public static ElectricAdmittance? FromMillisiemens(QuantityValue? millisiemens) + { + return millisiemens.HasValue ? FromMillisiemens(millisiemens.Value) : default(ElectricAdmittance?); + } + + /// + /// Get nullable ElectricAdmittance from nullable Nanosiemens. + /// + public static ElectricAdmittance? FromNanosiemens(QuantityValue? nanosiemens) + { + return nanosiemens.HasValue ? FromNanosiemens(nanosiemens.Value) : default(ElectricAdmittance?); + } + + /// + /// Get nullable ElectricAdmittance from nullable Siemens. + /// + public static ElectricAdmittance? FromSiemens(QuantityValue? siemens) + { + return siemens.HasValue ? FromSiemens(siemens.Value) : default(ElectricAdmittance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricAdmittance unit value. + public static ElectricAdmittance? From(QuantityValue? value, ElectricAdmittanceUnit fromUnit) + { + return value.HasValue ? new ElectricAdmittance((double)value.Value, fromUnit) : default(ElectricAdmittance?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricAdmittance operator -(ElectricAdmittance right) + { + return new ElectricAdmittance(-right.Value, right.Unit); + } + + public static ElectricAdmittance operator +(ElectricAdmittance left, ElectricAdmittance right) + { + return new ElectricAdmittance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricAdmittance operator -(ElectricAdmittance left, ElectricAdmittance right) + { + return new ElectricAdmittance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricAdmittance operator *(double left, ElectricAdmittance right) + { + return new ElectricAdmittance(left * right.Value, right.Unit); + } + + public static ElectricAdmittance operator *(ElectricAdmittance left, double right) + { + return new ElectricAdmittance(left.Value * right, left.Unit); + } + + public static ElectricAdmittance operator /(ElectricAdmittance left, double right) + { + return new ElectricAdmittance(left.Value / right, left.Unit); + } + + public static double operator /(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Siemens / right.Siemens; + } + + #endregion + + public static bool operator <=(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricAdmittance left, ElectricAdmittance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricAdmittance left, ElectricAdmittance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricAdmittance left, ElectricAdmittance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCharge.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCharge.NetFramework.g.cs index 6f1c768946..f6bb22c611 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCharge.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCharge.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricCharge : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricCharge from nullable Coulombs. + /// + public static ElectricCharge? FromCoulombs(QuantityValue? coulombs) + { + return coulombs.HasValue ? FromCoulombs(coulombs.Value) : default(ElectricCharge?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCharge unit value. + public static ElectricCharge? From(QuantityValue? value, ElectricChargeUnit fromUnit) + { + return value.HasValue ? new ElectricCharge((double)value.Value, fromUnit) : default(ElectricCharge?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricCharge operator -(ElectricCharge right) + { + return new ElectricCharge(-right.Value, right.Unit); + } + + public static ElectricCharge operator +(ElectricCharge left, ElectricCharge right) + { + return new ElectricCharge(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCharge operator -(ElectricCharge left, ElectricCharge right) + { + return new ElectricCharge(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCharge operator *(double left, ElectricCharge right) + { + return new ElectricCharge(left * right.Value, right.Unit); + } + + public static ElectricCharge operator *(ElectricCharge left, double right) + { + return new ElectricCharge(left.Value * right, left.Unit); + } + + public static ElectricCharge operator /(ElectricCharge left, double right) + { + return new ElectricCharge(left.Value / right, left.Unit); + } + + public static double operator /(ElectricCharge left, ElectricCharge right) + { + return left.Coulombs / right.Coulombs; + } + + #endregion + + public static bool operator <=(ElectricCharge left, ElectricCharge right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricCharge left, ElectricCharge right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricCharge left, ElectricCharge right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricCharge left, ElectricCharge right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricCharge left, ElectricCharge right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricCharge left, ElectricCharge right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricChargeDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricChargeDensity.NetFramework.g.cs index 262429ed40..c4aa6e2ecd 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricChargeDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricChargeDensity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricChargeDensity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricChargeDensity from nullable CoulombsPerCubicMeter. + /// + public static ElectricChargeDensity? FromCoulombsPerCubicMeter(QuantityValue? coulombspercubicmeter) + { + return coulombspercubicmeter.HasValue ? FromCoulombsPerCubicMeter(coulombspercubicmeter.Value) : default(ElectricChargeDensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricChargeDensity unit value. + public static ElectricChargeDensity? From(QuantityValue? value, ElectricChargeDensityUnit fromUnit) + { + return value.HasValue ? new ElectricChargeDensity((double)value.Value, fromUnit) : default(ElectricChargeDensity?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricChargeDensity operator -(ElectricChargeDensity right) + { + return new ElectricChargeDensity(-right.Value, right.Unit); + } + + public static ElectricChargeDensity operator +(ElectricChargeDensity left, ElectricChargeDensity right) + { + return new ElectricChargeDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricChargeDensity operator -(ElectricChargeDensity left, ElectricChargeDensity right) + { + return new ElectricChargeDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricChargeDensity operator *(double left, ElectricChargeDensity right) + { + return new ElectricChargeDensity(left * right.Value, right.Unit); + } + + public static ElectricChargeDensity operator *(ElectricChargeDensity left, double right) + { + return new ElectricChargeDensity(left.Value * right, left.Unit); + } + + public static ElectricChargeDensity operator /(ElectricChargeDensity left, double right) + { + return new ElectricChargeDensity(left.Value / right, left.Unit); + } + + public static double operator /(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.CoulombsPerCubicMeter / right.CoulombsPerCubicMeter; + } + + #endregion + + public static bool operator <=(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricChargeDensity left, ElectricChargeDensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricChargeDensity left, ElectricChargeDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricChargeDensity left, ElectricChargeDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductance.NetFramework.g.cs index 7fe168a372..d333b0ccd9 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductance.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct ElectricConductance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricConductance from nullable Microsiemens. + /// + public static ElectricConductance? FromMicrosiemens(QuantityValue? microsiemens) + { + return microsiemens.HasValue ? FromMicrosiemens(microsiemens.Value) : default(ElectricConductance?); + } + + /// + /// Get nullable ElectricConductance from nullable Millisiemens. + /// + public static ElectricConductance? FromMillisiemens(QuantityValue? millisiemens) + { + return millisiemens.HasValue ? FromMillisiemens(millisiemens.Value) : default(ElectricConductance?); + } + + /// + /// Get nullable ElectricConductance from nullable Siemens. + /// + public static ElectricConductance? FromSiemens(QuantityValue? siemens) + { + return siemens.HasValue ? FromSiemens(siemens.Value) : default(ElectricConductance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricConductance unit value. + public static ElectricConductance? From(QuantityValue? value, ElectricConductanceUnit fromUnit) + { + return value.HasValue ? new ElectricConductance((double)value.Value, fromUnit) : default(ElectricConductance?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricConductance operator -(ElectricConductance right) + { + return new ElectricConductance(-right.Value, right.Unit); + } + + public static ElectricConductance operator +(ElectricConductance left, ElectricConductance right) + { + return new ElectricConductance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricConductance operator -(ElectricConductance left, ElectricConductance right) + { + return new ElectricConductance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricConductance operator *(double left, ElectricConductance right) + { + return new ElectricConductance(left * right.Value, right.Unit); + } + + public static ElectricConductance operator *(ElectricConductance left, double right) + { + return new ElectricConductance(left.Value * right, left.Unit); + } + + public static ElectricConductance operator /(ElectricConductance left, double right) + { + return new ElectricConductance(left.Value / right, left.Unit); + } + + public static double operator /(ElectricConductance left, ElectricConductance right) + { + return left.Siemens / right.Siemens; + } + + #endregion + + public static bool operator <=(ElectricConductance left, ElectricConductance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricConductance left, ElectricConductance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricConductance left, ElectricConductance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricConductance left, ElectricConductance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricConductance left, ElectricConductance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricConductance left, ElectricConductance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductivity.NetFramework.g.cs index 9eff6f6cb6..5def412b07 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricConductivity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricConductivity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricConductivity from nullable SiemensPerMeter. + /// + public static ElectricConductivity? FromSiemensPerMeter(QuantityValue? siemenspermeter) + { + return siemenspermeter.HasValue ? FromSiemensPerMeter(siemenspermeter.Value) : default(ElectricConductivity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricConductivity unit value. + public static ElectricConductivity? From(QuantityValue? value, ElectricConductivityUnit fromUnit) + { + return value.HasValue ? new ElectricConductivity((double)value.Value, fromUnit) : default(ElectricConductivity?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricConductivity operator -(ElectricConductivity right) + { + return new ElectricConductivity(-right.Value, right.Unit); + } + + public static ElectricConductivity operator +(ElectricConductivity left, ElectricConductivity right) + { + return new ElectricConductivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricConductivity operator -(ElectricConductivity left, ElectricConductivity right) + { + return new ElectricConductivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricConductivity operator *(double left, ElectricConductivity right) + { + return new ElectricConductivity(left * right.Value, right.Unit); + } + + public static ElectricConductivity operator *(ElectricConductivity left, double right) + { + return new ElectricConductivity(left.Value * right, left.Unit); + } + + public static ElectricConductivity operator /(ElectricConductivity left, double right) + { + return new ElectricConductivity(left.Value / right, left.Unit); + } + + public static double operator /(ElectricConductivity left, ElectricConductivity right) + { + return left.SiemensPerMeter / right.SiemensPerMeter; + } + + #endregion + + public static bool operator <=(ElectricConductivity left, ElectricConductivity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricConductivity left, ElectricConductivity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricConductivity left, ElectricConductivity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricConductivity left, ElectricConductivity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricConductivity left, ElectricConductivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricConductivity left, ElectricConductivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrent.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrent.NetFramework.g.cs index 7aea2392f1..3e1dd9de79 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrent.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrent.NetFramework.g.cs @@ -59,5 +59,149 @@ public partial struct ElectricCurrent : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricCurrent from nullable Amperes. + /// + public static ElectricCurrent? FromAmperes(QuantityValue? amperes) + { + return amperes.HasValue ? FromAmperes(amperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Kiloamperes. + /// + public static ElectricCurrent? FromKiloamperes(QuantityValue? kiloamperes) + { + return kiloamperes.HasValue ? FromKiloamperes(kiloamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Megaamperes. + /// + public static ElectricCurrent? FromMegaamperes(QuantityValue? megaamperes) + { + return megaamperes.HasValue ? FromMegaamperes(megaamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Microamperes. + /// + public static ElectricCurrent? FromMicroamperes(QuantityValue? microamperes) + { + return microamperes.HasValue ? FromMicroamperes(microamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Milliamperes. + /// + public static ElectricCurrent? FromMilliamperes(QuantityValue? milliamperes) + { + return milliamperes.HasValue ? FromMilliamperes(milliamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Nanoamperes. + /// + public static ElectricCurrent? FromNanoamperes(QuantityValue? nanoamperes) + { + return nanoamperes.HasValue ? FromNanoamperes(nanoamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Get nullable ElectricCurrent from nullable Picoamperes. + /// + public static ElectricCurrent? FromPicoamperes(QuantityValue? picoamperes) + { + return picoamperes.HasValue ? FromPicoamperes(picoamperes.Value) : default(ElectricCurrent?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrent unit value. + public static ElectricCurrent? From(QuantityValue? value, ElectricCurrentUnit fromUnit) + { + return value.HasValue ? new ElectricCurrent((double)value.Value, fromUnit) : default(ElectricCurrent?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricCurrent operator -(ElectricCurrent right) + { + return new ElectricCurrent(-right.Value, right.Unit); + } + + public static ElectricCurrent operator +(ElectricCurrent left, ElectricCurrent right) + { + return new ElectricCurrent(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrent operator -(ElectricCurrent left, ElectricCurrent right) + { + return new ElectricCurrent(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrent operator *(double left, ElectricCurrent right) + { + return new ElectricCurrent(left * right.Value, right.Unit); + } + + public static ElectricCurrent operator *(ElectricCurrent left, double right) + { + return new ElectricCurrent(left.Value * right, left.Unit); + } + + public static ElectricCurrent operator /(ElectricCurrent left, double right) + { + return new ElectricCurrent(left.Value / right, left.Unit); + } + + public static double operator /(ElectricCurrent left, ElectricCurrent right) + { + return left.Amperes / right.Amperes; + } + + #endregion + + public static bool operator <=(ElectricCurrent left, ElectricCurrent right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricCurrent left, ElectricCurrent right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricCurrent left, ElectricCurrent right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricCurrent left, ElectricCurrent right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricCurrent left, ElectricCurrent right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricCurrent left, ElectricCurrent right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentDensity.NetFramework.g.cs index 56edc8155a..c6f28c7a7a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentDensity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricCurrentDensity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricCurrentDensity from nullable AmperesPerSquareMeter. + /// + public static ElectricCurrentDensity? FromAmperesPerSquareMeter(QuantityValue? amperespersquaremeter) + { + return amperespersquaremeter.HasValue ? FromAmperesPerSquareMeter(amperespersquaremeter.Value) : default(ElectricCurrentDensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrentDensity unit value. + public static ElectricCurrentDensity? From(QuantityValue? value, ElectricCurrentDensityUnit fromUnit) + { + return value.HasValue ? new ElectricCurrentDensity((double)value.Value, fromUnit) : default(ElectricCurrentDensity?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricCurrentDensity operator -(ElectricCurrentDensity right) + { + return new ElectricCurrentDensity(-right.Value, right.Unit); + } + + public static ElectricCurrentDensity operator +(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return new ElectricCurrentDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrentDensity operator -(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return new ElectricCurrentDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrentDensity operator *(double left, ElectricCurrentDensity right) + { + return new ElectricCurrentDensity(left * right.Value, right.Unit); + } + + public static ElectricCurrentDensity operator *(ElectricCurrentDensity left, double right) + { + return new ElectricCurrentDensity(left.Value * right, left.Unit); + } + + public static ElectricCurrentDensity operator /(ElectricCurrentDensity left, double right) + { + return new ElectricCurrentDensity(left.Value / right, left.Unit); + } + + public static double operator /(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.AmperesPerSquareMeter / right.AmperesPerSquareMeter; + } + + #endregion + + public static bool operator <=(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricCurrentDensity left, ElectricCurrentDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentGradient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentGradient.NetFramework.g.cs index cdc9ae1bc4..dacb1476b6 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentGradient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricCurrentGradient.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricCurrentGradient : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricCurrentGradient from nullable AmperesPerSecond. + /// + public static ElectricCurrentGradient? FromAmperesPerSecond(QuantityValue? amperespersecond) + { + return amperespersecond.HasValue ? FromAmperesPerSecond(amperespersecond.Value) : default(ElectricCurrentGradient?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricCurrentGradient unit value. + public static ElectricCurrentGradient? From(QuantityValue? value, ElectricCurrentGradientUnit fromUnit) + { + return value.HasValue ? new ElectricCurrentGradient((double)value.Value, fromUnit) : default(ElectricCurrentGradient?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricCurrentGradient operator -(ElectricCurrentGradient right) + { + return new ElectricCurrentGradient(-right.Value, right.Unit); + } + + public static ElectricCurrentGradient operator +(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return new ElectricCurrentGradient(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrentGradient operator -(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return new ElectricCurrentGradient(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricCurrentGradient operator *(double left, ElectricCurrentGradient right) + { + return new ElectricCurrentGradient(left * right.Value, right.Unit); + } + + public static ElectricCurrentGradient operator *(ElectricCurrentGradient left, double right) + { + return new ElectricCurrentGradient(left.Value * right, left.Unit); + } + + public static ElectricCurrentGradient operator /(ElectricCurrentGradient left, double right) + { + return new ElectricCurrentGradient(left.Value / right, left.Unit); + } + + public static double operator /(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.AmperesPerSecond / right.AmperesPerSecond; + } + + #endregion + + public static bool operator <=(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricCurrentGradient left, ElectricCurrentGradient right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricField.NetFramework.g.cs index 0cb5f8d68b..64ba6f00c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricField.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricField : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricField from nullable VoltsPerMeter. + /// + public static ElectricField? FromVoltsPerMeter(QuantityValue? voltspermeter) + { + return voltspermeter.HasValue ? FromVoltsPerMeter(voltspermeter.Value) : default(ElectricField?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricField unit value. + public static ElectricField? From(QuantityValue? value, ElectricFieldUnit fromUnit) + { + return value.HasValue ? new ElectricField((double)value.Value, fromUnit) : default(ElectricField?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricField operator -(ElectricField right) + { + return new ElectricField(-right.Value, right.Unit); + } + + public static ElectricField operator +(ElectricField left, ElectricField right) + { + return new ElectricField(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricField operator -(ElectricField left, ElectricField right) + { + return new ElectricField(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricField operator *(double left, ElectricField right) + { + return new ElectricField(left * right.Value, right.Unit); + } + + public static ElectricField operator *(ElectricField left, double right) + { + return new ElectricField(left.Value * right, left.Unit); + } + + public static ElectricField operator /(ElectricField left, double right) + { + return new ElectricField(left.Value / right, left.Unit); + } + + public static double operator /(ElectricField left, ElectricField right) + { + return left.VoltsPerMeter / right.VoltsPerMeter; + } + + #endregion + + public static bool operator <=(ElectricField left, ElectricField right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricField left, ElectricField right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricField left, ElectricField right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricField left, ElectricField right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricField left, ElectricField right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricField left, ElectricField right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricInductance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricInductance.NetFramework.g.cs index 81054adaf4..47fa6d74b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricInductance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricInductance.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct ElectricInductance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricInductance from nullable Henries. + /// + public static ElectricInductance? FromHenries(QuantityValue? henries) + { + return henries.HasValue ? FromHenries(henries.Value) : default(ElectricInductance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricInductance unit value. + public static ElectricInductance? From(QuantityValue? value, ElectricInductanceUnit fromUnit) + { + return value.HasValue ? new ElectricInductance((double)value.Value, fromUnit) : default(ElectricInductance?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricInductance operator -(ElectricInductance right) + { + return new ElectricInductance(-right.Value, right.Unit); + } + + public static ElectricInductance operator +(ElectricInductance left, ElectricInductance right) + { + return new ElectricInductance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricInductance operator -(ElectricInductance left, ElectricInductance right) + { + return new ElectricInductance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricInductance operator *(double left, ElectricInductance right) + { + return new ElectricInductance(left * right.Value, right.Unit); + } + + public static ElectricInductance operator *(ElectricInductance left, double right) + { + return new ElectricInductance(left.Value * right, left.Unit); + } + + public static ElectricInductance operator /(ElectricInductance left, double right) + { + return new ElectricInductance(left.Value / right, left.Unit); + } + + public static double operator /(ElectricInductance left, ElectricInductance right) + { + return left.Henries / right.Henries; + } + + #endregion + + public static bool operator <=(ElectricInductance left, ElectricInductance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricInductance left, ElectricInductance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricInductance left, ElectricInductance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricInductance left, ElectricInductance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricInductance left, ElectricInductance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricInductance left, ElectricInductance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotential.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotential.NetFramework.g.cs index d4dd9e4a05..896d43db6a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotential.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotential.NetFramework.g.cs @@ -59,5 +59,133 @@ public partial struct ElectricPotential : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricPotential from nullable Kilovolts. + /// + public static ElectricPotential? FromKilovolts(QuantityValue? kilovolts) + { + return kilovolts.HasValue ? FromKilovolts(kilovolts.Value) : default(ElectricPotential?); + } + + /// + /// Get nullable ElectricPotential from nullable Megavolts. + /// + public static ElectricPotential? FromMegavolts(QuantityValue? megavolts) + { + return megavolts.HasValue ? FromMegavolts(megavolts.Value) : default(ElectricPotential?); + } + + /// + /// Get nullable ElectricPotential from nullable Microvolts. + /// + public static ElectricPotential? FromMicrovolts(QuantityValue? microvolts) + { + return microvolts.HasValue ? FromMicrovolts(microvolts.Value) : default(ElectricPotential?); + } + + /// + /// Get nullable ElectricPotential from nullable Millivolts. + /// + public static ElectricPotential? FromMillivolts(QuantityValue? millivolts) + { + return millivolts.HasValue ? FromMillivolts(millivolts.Value) : default(ElectricPotential?); + } + + /// + /// Get nullable ElectricPotential from nullable Volts. + /// + public static ElectricPotential? FromVolts(QuantityValue? volts) + { + return volts.HasValue ? FromVolts(volts.Value) : default(ElectricPotential?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotential unit value. + public static ElectricPotential? From(QuantityValue? value, ElectricPotentialUnit fromUnit) + { + return value.HasValue ? new ElectricPotential((double)value.Value, fromUnit) : default(ElectricPotential?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricPotential operator -(ElectricPotential right) + { + return new ElectricPotential(-right.Value, right.Unit); + } + + public static ElectricPotential operator +(ElectricPotential left, ElectricPotential right) + { + return new ElectricPotential(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotential operator -(ElectricPotential left, ElectricPotential right) + { + return new ElectricPotential(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotential operator *(double left, ElectricPotential right) + { + return new ElectricPotential(left * right.Value, right.Unit); + } + + public static ElectricPotential operator *(ElectricPotential left, double right) + { + return new ElectricPotential(left.Value * right, left.Unit); + } + + public static ElectricPotential operator /(ElectricPotential left, double right) + { + return new ElectricPotential(left.Value / right, left.Unit); + } + + public static double operator /(ElectricPotential left, ElectricPotential right) + { + return left.Volts / right.Volts; + } + + #endregion + + public static bool operator <=(ElectricPotential left, ElectricPotential right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricPotential left, ElectricPotential right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricPotential left, ElectricPotential right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricPotential left, ElectricPotential right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricPotential left, ElectricPotential right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricPotential left, ElectricPotential right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialAc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialAc.NetFramework.g.cs index e05de7a56a..96e868d76a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialAc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialAc.NetFramework.g.cs @@ -59,5 +59,133 @@ public partial struct ElectricPotentialAc : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricPotentialAc from nullable KilovoltsAc. + /// + public static ElectricPotentialAc? FromKilovoltsAc(QuantityValue? kilovoltsac) + { + return kilovoltsac.HasValue ? FromKilovoltsAc(kilovoltsac.Value) : default(ElectricPotentialAc?); + } + + /// + /// Get nullable ElectricPotentialAc from nullable MegavoltsAc. + /// + public static ElectricPotentialAc? FromMegavoltsAc(QuantityValue? megavoltsac) + { + return megavoltsac.HasValue ? FromMegavoltsAc(megavoltsac.Value) : default(ElectricPotentialAc?); + } + + /// + /// Get nullable ElectricPotentialAc from nullable MicrovoltsAc. + /// + public static ElectricPotentialAc? FromMicrovoltsAc(QuantityValue? microvoltsac) + { + return microvoltsac.HasValue ? FromMicrovoltsAc(microvoltsac.Value) : default(ElectricPotentialAc?); + } + + /// + /// Get nullable ElectricPotentialAc from nullable MillivoltsAc. + /// + public static ElectricPotentialAc? FromMillivoltsAc(QuantityValue? millivoltsac) + { + return millivoltsac.HasValue ? FromMillivoltsAc(millivoltsac.Value) : default(ElectricPotentialAc?); + } + + /// + /// Get nullable ElectricPotentialAc from nullable VoltsAc. + /// + public static ElectricPotentialAc? FromVoltsAc(QuantityValue? voltsac) + { + return voltsac.HasValue ? FromVoltsAc(voltsac.Value) : default(ElectricPotentialAc?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotentialAc unit value. + public static ElectricPotentialAc? From(QuantityValue? value, ElectricPotentialAcUnit fromUnit) + { + return value.HasValue ? new ElectricPotentialAc((double)value.Value, fromUnit) : default(ElectricPotentialAc?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricPotentialAc operator -(ElectricPotentialAc right) + { + return new ElectricPotentialAc(-right.Value, right.Unit); + } + + public static ElectricPotentialAc operator +(ElectricPotentialAc left, ElectricPotentialAc right) + { + return new ElectricPotentialAc(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotentialAc operator -(ElectricPotentialAc left, ElectricPotentialAc right) + { + return new ElectricPotentialAc(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotentialAc operator *(double left, ElectricPotentialAc right) + { + return new ElectricPotentialAc(left * right.Value, right.Unit); + } + + public static ElectricPotentialAc operator *(ElectricPotentialAc left, double right) + { + return new ElectricPotentialAc(left.Value * right, left.Unit); + } + + public static ElectricPotentialAc operator /(ElectricPotentialAc left, double right) + { + return new ElectricPotentialAc(left.Value / right, left.Unit); + } + + public static double operator /(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.VoltsAc / right.VoltsAc; + } + + #endregion + + public static bool operator <=(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricPotentialAc left, ElectricPotentialAc right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricPotentialAc left, ElectricPotentialAc right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricPotentialAc left, ElectricPotentialAc right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialDc.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialDc.NetFramework.g.cs index b660d08b5d..1e50e8e76c 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialDc.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricPotentialDc.NetFramework.g.cs @@ -59,5 +59,133 @@ public partial struct ElectricPotentialDc : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricPotentialDc from nullable KilovoltsDc. + /// + public static ElectricPotentialDc? FromKilovoltsDc(QuantityValue? kilovoltsdc) + { + return kilovoltsdc.HasValue ? FromKilovoltsDc(kilovoltsdc.Value) : default(ElectricPotentialDc?); + } + + /// + /// Get nullable ElectricPotentialDc from nullable MegavoltsDc. + /// + public static ElectricPotentialDc? FromMegavoltsDc(QuantityValue? megavoltsdc) + { + return megavoltsdc.HasValue ? FromMegavoltsDc(megavoltsdc.Value) : default(ElectricPotentialDc?); + } + + /// + /// Get nullable ElectricPotentialDc from nullable MicrovoltsDc. + /// + public static ElectricPotentialDc? FromMicrovoltsDc(QuantityValue? microvoltsdc) + { + return microvoltsdc.HasValue ? FromMicrovoltsDc(microvoltsdc.Value) : default(ElectricPotentialDc?); + } + + /// + /// Get nullable ElectricPotentialDc from nullable MillivoltsDc. + /// + public static ElectricPotentialDc? FromMillivoltsDc(QuantityValue? millivoltsdc) + { + return millivoltsdc.HasValue ? FromMillivoltsDc(millivoltsdc.Value) : default(ElectricPotentialDc?); + } + + /// + /// Get nullable ElectricPotentialDc from nullable VoltsDc. + /// + public static ElectricPotentialDc? FromVoltsDc(QuantityValue? voltsdc) + { + return voltsdc.HasValue ? FromVoltsDc(voltsdc.Value) : default(ElectricPotentialDc?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricPotentialDc unit value. + public static ElectricPotentialDc? From(QuantityValue? value, ElectricPotentialDcUnit fromUnit) + { + return value.HasValue ? new ElectricPotentialDc((double)value.Value, fromUnit) : default(ElectricPotentialDc?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricPotentialDc operator -(ElectricPotentialDc right) + { + return new ElectricPotentialDc(-right.Value, right.Unit); + } + + public static ElectricPotentialDc operator +(ElectricPotentialDc left, ElectricPotentialDc right) + { + return new ElectricPotentialDc(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotentialDc operator -(ElectricPotentialDc left, ElectricPotentialDc right) + { + return new ElectricPotentialDc(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricPotentialDc operator *(double left, ElectricPotentialDc right) + { + return new ElectricPotentialDc(left * right.Value, right.Unit); + } + + public static ElectricPotentialDc operator *(ElectricPotentialDc left, double right) + { + return new ElectricPotentialDc(left.Value * right, left.Unit); + } + + public static ElectricPotentialDc operator /(ElectricPotentialDc left, double right) + { + return new ElectricPotentialDc(left.Value / right, left.Unit); + } + + public static double operator /(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.VoltsDc / right.VoltsDc; + } + + #endregion + + public static bool operator <=(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricPotentialDc left, ElectricPotentialDc right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricPotentialDc left, ElectricPotentialDc right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricPotentialDc left, ElectricPotentialDc right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistance.NetFramework.g.cs index 4fc552823f..5b9bb5e187 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistance.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct ElectricResistance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricResistance from nullable Kiloohms. + /// + public static ElectricResistance? FromKiloohms(QuantityValue? kiloohms) + { + return kiloohms.HasValue ? FromKiloohms(kiloohms.Value) : default(ElectricResistance?); + } + + /// + /// Get nullable ElectricResistance from nullable Megaohms. + /// + public static ElectricResistance? FromMegaohms(QuantityValue? megaohms) + { + return megaohms.HasValue ? FromMegaohms(megaohms.Value) : default(ElectricResistance?); + } + + /// + /// Get nullable ElectricResistance from nullable Milliohms. + /// + public static ElectricResistance? FromMilliohms(QuantityValue? milliohms) + { + return milliohms.HasValue ? FromMilliohms(milliohms.Value) : default(ElectricResistance?); + } + + /// + /// Get nullable ElectricResistance from nullable Ohms. + /// + public static ElectricResistance? FromOhms(QuantityValue? ohms) + { + return ohms.HasValue ? FromOhms(ohms.Value) : default(ElectricResistance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricResistance unit value. + public static ElectricResistance? From(QuantityValue? value, ElectricResistanceUnit fromUnit) + { + return value.HasValue ? new ElectricResistance((double)value.Value, fromUnit) : default(ElectricResistance?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricResistance operator -(ElectricResistance right) + { + return new ElectricResistance(-right.Value, right.Unit); + } + + public static ElectricResistance operator +(ElectricResistance left, ElectricResistance right) + { + return new ElectricResistance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricResistance operator -(ElectricResistance left, ElectricResistance right) + { + return new ElectricResistance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricResistance operator *(double left, ElectricResistance right) + { + return new ElectricResistance(left * right.Value, right.Unit); + } + + public static ElectricResistance operator *(ElectricResistance left, double right) + { + return new ElectricResistance(left.Value * right, left.Unit); + } + + public static ElectricResistance operator /(ElectricResistance left, double right) + { + return new ElectricResistance(left.Value / right, left.Unit); + } + + public static double operator /(ElectricResistance left, ElectricResistance right) + { + return left.Ohms / right.Ohms; + } + + #endregion + + public static bool operator <=(ElectricResistance left, ElectricResistance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricResistance left, ElectricResistance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricResistance left, ElectricResistance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricResistance left, ElectricResistance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricResistance left, ElectricResistance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricResistance left, ElectricResistance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistivity.NetFramework.g.cs index b78b065350..2ebf6c762f 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ElectricResistivity.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct ElectricResistivity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ElectricResistivity from nullable MicroohmMeters. + /// + public static ElectricResistivity? FromMicroohmMeters(QuantityValue? microohmmeters) + { + return microohmmeters.HasValue ? FromMicroohmMeters(microohmmeters.Value) : default(ElectricResistivity?); + } + + /// + /// Get nullable ElectricResistivity from nullable MilliohmMeters. + /// + public static ElectricResistivity? FromMilliohmMeters(QuantityValue? milliohmmeters) + { + return milliohmmeters.HasValue ? FromMilliohmMeters(milliohmmeters.Value) : default(ElectricResistivity?); + } + + /// + /// Get nullable ElectricResistivity from nullable NanoohmMeters. + /// + public static ElectricResistivity? FromNanoohmMeters(QuantityValue? nanoohmmeters) + { + return nanoohmmeters.HasValue ? FromNanoohmMeters(nanoohmmeters.Value) : default(ElectricResistivity?); + } + + /// + /// Get nullable ElectricResistivity from nullable OhmMeters. + /// + public static ElectricResistivity? FromOhmMeters(QuantityValue? ohmmeters) + { + return ohmmeters.HasValue ? FromOhmMeters(ohmmeters.Value) : default(ElectricResistivity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ElectricResistivity unit value. + public static ElectricResistivity? From(QuantityValue? value, ElectricResistivityUnit fromUnit) + { + return value.HasValue ? new ElectricResistivity((double)value.Value, fromUnit) : default(ElectricResistivity?); + } + + #endregion + + #region Arithmetic Operators + + public static ElectricResistivity operator -(ElectricResistivity right) + { + return new ElectricResistivity(-right.Value, right.Unit); + } + + public static ElectricResistivity operator +(ElectricResistivity left, ElectricResistivity right) + { + return new ElectricResistivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricResistivity operator -(ElectricResistivity left, ElectricResistivity right) + { + return new ElectricResistivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ElectricResistivity operator *(double left, ElectricResistivity right) + { + return new ElectricResistivity(left * right.Value, right.Unit); + } + + public static ElectricResistivity operator *(ElectricResistivity left, double right) + { + return new ElectricResistivity(left.Value * right, left.Unit); + } + + public static ElectricResistivity operator /(ElectricResistivity left, double right) + { + return new ElectricResistivity(left.Value / right, left.Unit); + } + + public static double operator /(ElectricResistivity left, ElectricResistivity right) + { + return left.OhmMeters / right.OhmMeters; + } + + #endregion + + public static bool operator <=(ElectricResistivity left, ElectricResistivity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ElectricResistivity left, ElectricResistivity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ElectricResistivity left, ElectricResistivity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ElectricResistivity left, ElectricResistivity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ElectricResistivity left, ElectricResistivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ElectricResistivity left, ElectricResistivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Energy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Energy.NetFramework.g.cs index 256ee38d07..8c18e1dda5 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Energy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Energy.NetFramework.g.cs @@ -59,5 +59,269 @@ public partial struct Energy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Energy from nullable BritishThermalUnits. + /// + public static Energy? FromBritishThermalUnits(QuantityValue? britishthermalunits) + { + return britishthermalunits.HasValue ? FromBritishThermalUnits(britishthermalunits.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Calories. + /// + public static Energy? FromCalories(QuantityValue? calories) + { + return calories.HasValue ? FromCalories(calories.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable DecathermsEc. + /// + public static Energy? FromDecathermsEc(QuantityValue? decathermsec) + { + return decathermsec.HasValue ? FromDecathermsEc(decathermsec.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable DecathermsImperial. + /// + public static Energy? FromDecathermsImperial(QuantityValue? decathermsimperial) + { + return decathermsimperial.HasValue ? FromDecathermsImperial(decathermsimperial.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable DecathermsUs. + /// + public static Energy? FromDecathermsUs(QuantityValue? decathermsus) + { + return decathermsus.HasValue ? FromDecathermsUs(decathermsus.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable ElectronVolts. + /// + public static Energy? FromElectronVolts(QuantityValue? electronvolts) + { + return electronvolts.HasValue ? FromElectronVolts(electronvolts.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Ergs. + /// + public static Energy? FromErgs(QuantityValue? ergs) + { + return ergs.HasValue ? FromErgs(ergs.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable FootPounds. + /// + public static Energy? FromFootPounds(QuantityValue? footpounds) + { + return footpounds.HasValue ? FromFootPounds(footpounds.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable GigabritishThermalUnits. + /// + public static Energy? FromGigabritishThermalUnits(QuantityValue? gigabritishthermalunits) + { + return gigabritishthermalunits.HasValue ? FromGigabritishThermalUnits(gigabritishthermalunits.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable GigawattHours. + /// + public static Energy? FromGigawattHours(QuantityValue? gigawatthours) + { + return gigawatthours.HasValue ? FromGigawattHours(gigawatthours.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Joules. + /// + public static Energy? FromJoules(QuantityValue? joules) + { + return joules.HasValue ? FromJoules(joules.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable KilobritishThermalUnits. + /// + public static Energy? FromKilobritishThermalUnits(QuantityValue? kilobritishthermalunits) + { + return kilobritishthermalunits.HasValue ? FromKilobritishThermalUnits(kilobritishthermalunits.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Kilocalories. + /// + public static Energy? FromKilocalories(QuantityValue? kilocalories) + { + return kilocalories.HasValue ? FromKilocalories(kilocalories.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Kilojoules. + /// + public static Energy? FromKilojoules(QuantityValue? kilojoules) + { + return kilojoules.HasValue ? FromKilojoules(kilojoules.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable KilowattHours. + /// + public static Energy? FromKilowattHours(QuantityValue? kilowatthours) + { + return kilowatthours.HasValue ? FromKilowattHours(kilowatthours.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable MegabritishThermalUnits. + /// + public static Energy? FromMegabritishThermalUnits(QuantityValue? megabritishthermalunits) + { + return megabritishthermalunits.HasValue ? FromMegabritishThermalUnits(megabritishthermalunits.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable Megajoules. + /// + public static Energy? FromMegajoules(QuantityValue? megajoules) + { + return megajoules.HasValue ? FromMegajoules(megajoules.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable MegawattHours. + /// + public static Energy? FromMegawattHours(QuantityValue? megawatthours) + { + return megawatthours.HasValue ? FromMegawattHours(megawatthours.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable ThermsEc. + /// + public static Energy? FromThermsEc(QuantityValue? thermsec) + { + return thermsec.HasValue ? FromThermsEc(thermsec.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable ThermsImperial. + /// + public static Energy? FromThermsImperial(QuantityValue? thermsimperial) + { + return thermsimperial.HasValue ? FromThermsImperial(thermsimperial.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable ThermsUs. + /// + public static Energy? FromThermsUs(QuantityValue? thermsus) + { + return thermsus.HasValue ? FromThermsUs(thermsus.Value) : default(Energy?); + } + + /// + /// Get nullable Energy from nullable WattHours. + /// + public static Energy? FromWattHours(QuantityValue? watthours) + { + return watthours.HasValue ? FromWattHours(watthours.Value) : default(Energy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Energy unit value. + public static Energy? From(QuantityValue? value, EnergyUnit fromUnit) + { + return value.HasValue ? new Energy((double)value.Value, fromUnit) : default(Energy?); + } + + #endregion + + #region Arithmetic Operators + + public static Energy operator -(Energy right) + { + return new Energy(-right.Value, right.Unit); + } + + public static Energy operator +(Energy left, Energy right) + { + return new Energy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Energy operator -(Energy left, Energy right) + { + return new Energy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Energy operator *(double left, Energy right) + { + return new Energy(left * right.Value, right.Unit); + } + + public static Energy operator *(Energy left, double right) + { + return new Energy(left.Value * right, left.Unit); + } + + public static Energy operator /(Energy left, double right) + { + return new Energy(left.Value / right, left.Unit); + } + + public static double operator /(Energy left, Energy right) + { + return left.Joules / right.Joules; + } + + #endregion + + public static bool operator <=(Energy left, Energy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Energy left, Energy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Energy left, Energy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Energy left, Energy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Energy left, Energy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Energy left, Energy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Entropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Entropy.NetFramework.g.cs index c681959907..1a7f4c38a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Entropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Entropy.NetFramework.g.cs @@ -59,5 +59,149 @@ public partial struct Entropy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Entropy from nullable CaloriesPerKelvin. + /// + public static Entropy? FromCaloriesPerKelvin(QuantityValue? caloriesperkelvin) + { + return caloriesperkelvin.HasValue ? FromCaloriesPerKelvin(caloriesperkelvin.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable JoulesPerDegreeCelsius. + /// + public static Entropy? FromJoulesPerDegreeCelsius(QuantityValue? joulesperdegreecelsius) + { + return joulesperdegreecelsius.HasValue ? FromJoulesPerDegreeCelsius(joulesperdegreecelsius.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable JoulesPerKelvin. + /// + public static Entropy? FromJoulesPerKelvin(QuantityValue? joulesperkelvin) + { + return joulesperkelvin.HasValue ? FromJoulesPerKelvin(joulesperkelvin.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable KilocaloriesPerKelvin. + /// + public static Entropy? FromKilocaloriesPerKelvin(QuantityValue? kilocaloriesperkelvin) + { + return kilocaloriesperkelvin.HasValue ? FromKilocaloriesPerKelvin(kilocaloriesperkelvin.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable KilojoulesPerDegreeCelsius. + /// + public static Entropy? FromKilojoulesPerDegreeCelsius(QuantityValue? kilojoulesperdegreecelsius) + { + return kilojoulesperdegreecelsius.HasValue ? FromKilojoulesPerDegreeCelsius(kilojoulesperdegreecelsius.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable KilojoulesPerKelvin. + /// + public static Entropy? FromKilojoulesPerKelvin(QuantityValue? kilojoulesperkelvin) + { + return kilojoulesperkelvin.HasValue ? FromKilojoulesPerKelvin(kilojoulesperkelvin.Value) : default(Entropy?); + } + + /// + /// Get nullable Entropy from nullable MegajoulesPerKelvin. + /// + public static Entropy? FromMegajoulesPerKelvin(QuantityValue? megajoulesperkelvin) + { + return megajoulesperkelvin.HasValue ? FromMegajoulesPerKelvin(megajoulesperkelvin.Value) : default(Entropy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Entropy unit value. + public static Entropy? From(QuantityValue? value, EntropyUnit fromUnit) + { + return value.HasValue ? new Entropy((double)value.Value, fromUnit) : default(Entropy?); + } + + #endregion + + #region Arithmetic Operators + + public static Entropy operator -(Entropy right) + { + return new Entropy(-right.Value, right.Unit); + } + + public static Entropy operator +(Entropy left, Entropy right) + { + return new Entropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Entropy operator -(Entropy left, Entropy right) + { + return new Entropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Entropy operator *(double left, Entropy right) + { + return new Entropy(left * right.Value, right.Unit); + } + + public static Entropy operator *(Entropy left, double right) + { + return new Entropy(left.Value * right, left.Unit); + } + + public static Entropy operator /(Entropy left, double right) + { + return new Entropy(left.Value / right, left.Unit); + } + + public static double operator /(Entropy left, Entropy right) + { + return left.JoulesPerKelvin / right.JoulesPerKelvin; + } + + #endregion + + public static bool operator <=(Entropy left, Entropy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Entropy left, Entropy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Entropy left, Entropy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Entropy left, Entropy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Entropy left, Entropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Entropy left, Entropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Flow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Flow.NetFramework.g.cs index be2b3770a9..086bdc98e5 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Flow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Flow.NetFramework.g.cs @@ -59,5 +59,285 @@ public partial struct Flow : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Flow from nullable CentilitersPerMinute. + /// + public static Flow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) + { + return centilitersperminute.HasValue ? FromCentilitersPerMinute(centilitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicDecimetersPerMinute. + /// + public static Flow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) + { + return cubicdecimetersperminute.HasValue ? FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicFeetPerHour. + /// + public static Flow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) + { + return cubicfeetperhour.HasValue ? FromCubicFeetPerHour(cubicfeetperhour.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicFeetPerMinute. + /// + public static Flow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) + { + return cubicfeetperminute.HasValue ? FromCubicFeetPerMinute(cubicfeetperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicFeetPerSecond. + /// + public static Flow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) + { + return cubicfeetpersecond.HasValue ? FromCubicFeetPerSecond(cubicfeetpersecond.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicMetersPerHour. + /// + public static Flow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) + { + return cubicmetersperhour.HasValue ? FromCubicMetersPerHour(cubicmetersperhour.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicMetersPerMinute. + /// + public static Flow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) + { + return cubicmetersperminute.HasValue ? FromCubicMetersPerMinute(cubicmetersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicMetersPerSecond. + /// + public static Flow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) + { + return cubicmeterspersecond.HasValue ? FromCubicMetersPerSecond(cubicmeterspersecond.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicYardsPerHour. + /// + public static Flow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) + { + return cubicyardsperhour.HasValue ? FromCubicYardsPerHour(cubicyardsperhour.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicYardsPerMinute. + /// + public static Flow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) + { + return cubicyardsperminute.HasValue ? FromCubicYardsPerMinute(cubicyardsperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable CubicYardsPerSecond. + /// + public static Flow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) + { + return cubicyardspersecond.HasValue ? FromCubicYardsPerSecond(cubicyardspersecond.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable DecilitersPerMinute. + /// + public static Flow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) + { + return decilitersperminute.HasValue ? FromDecilitersPerMinute(decilitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable KilolitersPerMinute. + /// + public static Flow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) + { + return kilolitersperminute.HasValue ? FromKilolitersPerMinute(kilolitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable LitersPerHour. + /// + public static Flow? FromLitersPerHour(QuantityValue? litersperhour) + { + return litersperhour.HasValue ? FromLitersPerHour(litersperhour.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable LitersPerMinute. + /// + public static Flow? FromLitersPerMinute(QuantityValue? litersperminute) + { + return litersperminute.HasValue ? FromLitersPerMinute(litersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable LitersPerSecond. + /// + public static Flow? FromLitersPerSecond(QuantityValue? literspersecond) + { + return literspersecond.HasValue ? FromLitersPerSecond(literspersecond.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable MicrolitersPerMinute. + /// + public static Flow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) + { + return microlitersperminute.HasValue ? FromMicrolitersPerMinute(microlitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable MillilitersPerMinute. + /// + public static Flow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) + { + return millilitersperminute.HasValue ? FromMillilitersPerMinute(millilitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable MillionUsGallonsPerDay. + /// + public static Flow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) + { + return millionusgallonsperday.HasValue ? FromMillionUsGallonsPerDay(millionusgallonsperday.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable NanolitersPerMinute. + /// + public static Flow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) + { + return nanolitersperminute.HasValue ? FromNanolitersPerMinute(nanolitersperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable OilBarrelsPerDay. + /// + public static Flow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) + { + return oilbarrelsperday.HasValue ? FromOilBarrelsPerDay(oilbarrelsperday.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable UsGallonsPerHour. + /// + public static Flow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) + { + return usgallonsperhour.HasValue ? FromUsGallonsPerHour(usgallonsperhour.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable UsGallonsPerMinute. + /// + public static Flow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) + { + return usgallonsperminute.HasValue ? FromUsGallonsPerMinute(usgallonsperminute.Value) : default(Flow?); + } + + /// + /// Get nullable Flow from nullable UsGallonsPerSecond. + /// + public static Flow? FromUsGallonsPerSecond(QuantityValue? usgallonspersecond) + { + return usgallonspersecond.HasValue ? FromUsGallonsPerSecond(usgallonspersecond.Value) : default(Flow?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Flow unit value. + public static Flow? From(QuantityValue? value, FlowUnit fromUnit) + { + return value.HasValue ? new Flow((double)value.Value, fromUnit) : default(Flow?); + } + + #endregion + + #region Arithmetic Operators + + public static Flow operator -(Flow right) + { + return new Flow(-right.Value, right.Unit); + } + + public static Flow operator +(Flow left, Flow right) + { + return new Flow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Flow operator -(Flow left, Flow right) + { + return new Flow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Flow operator *(double left, Flow right) + { + return new Flow(left * right.Value, right.Unit); + } + + public static Flow operator *(Flow left, double right) + { + return new Flow(left.Value * right, left.Unit); + } + + public static Flow operator /(Flow left, double right) + { + return new Flow(left.Value / right, left.Unit); + } + + public static double operator /(Flow left, Flow right) + { + return left.CubicMetersPerSecond / right.CubicMetersPerSecond; + } + + #endregion + + public static bool operator <=(Flow left, Flow right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Flow left, Flow right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Flow left, Flow right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Flow left, Flow right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Flow left, Flow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Flow left, Flow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Force.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Force.NetFramework.g.cs index fd07825840..c5ac0e0a78 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Force.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Force.NetFramework.g.cs @@ -59,5 +59,173 @@ public partial struct Force : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Force from nullable Decanewtons. + /// + public static Force? FromDecanewtons(QuantityValue? decanewtons) + { + return decanewtons.HasValue ? FromDecanewtons(decanewtons.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Dyne. + /// + public static Force? FromDyne(QuantityValue? dyne) + { + return dyne.HasValue ? FromDyne(dyne.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable KilogramsForce. + /// + public static Force? FromKilogramsForce(QuantityValue? kilogramsforce) + { + return kilogramsforce.HasValue ? FromKilogramsForce(kilogramsforce.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Kilonewtons. + /// + public static Force? FromKilonewtons(QuantityValue? kilonewtons) + { + return kilonewtons.HasValue ? FromKilonewtons(kilonewtons.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable KiloPonds. + /// + public static Force? FromKiloPonds(QuantityValue? kiloponds) + { + return kiloponds.HasValue ? FromKiloPonds(kiloponds.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Meganewtons. + /// + public static Force? FromMeganewtons(QuantityValue? meganewtons) + { + return meganewtons.HasValue ? FromMeganewtons(meganewtons.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Newtons. + /// + public static Force? FromNewtons(QuantityValue? newtons) + { + return newtons.HasValue ? FromNewtons(newtons.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable Poundals. + /// + public static Force? FromPoundals(QuantityValue? poundals) + { + return poundals.HasValue ? FromPoundals(poundals.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable PoundsForce. + /// + public static Force? FromPoundsForce(QuantityValue? poundsforce) + { + return poundsforce.HasValue ? FromPoundsForce(poundsforce.Value) : default(Force?); + } + + /// + /// Get nullable Force from nullable TonnesForce. + /// + public static Force? FromTonnesForce(QuantityValue? tonnesforce) + { + return tonnesforce.HasValue ? FromTonnesForce(tonnesforce.Value) : default(Force?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Force unit value. + public static Force? From(QuantityValue? value, ForceUnit fromUnit) + { + return value.HasValue ? new Force((double)value.Value, fromUnit) : default(Force?); + } + + #endregion + + #region Arithmetic Operators + + public static Force operator -(Force right) + { + return new Force(-right.Value, right.Unit); + } + + public static Force operator +(Force left, Force right) + { + return new Force(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Force operator -(Force left, Force right) + { + return new Force(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Force operator *(double left, Force right) + { + return new Force(left * right.Value, right.Unit); + } + + public static Force operator *(Force left, double right) + { + return new Force(left.Value * right, left.Unit); + } + + public static Force operator /(Force left, double right) + { + return new Force(left.Value / right, left.Unit); + } + + public static double operator /(Force left, Force right) + { + return left.Newtons / right.Newtons; + } + + #endregion + + public static bool operator <=(Force left, Force right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Force left, Force right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Force left, Force right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Force left, Force right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Force left, Force right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Force left, Force right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ForceChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ForceChangeRate.NetFramework.g.cs index e5c6490b5a..1d6874c2ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ForceChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ForceChangeRate.NetFramework.g.cs @@ -59,5 +59,181 @@ public partial struct ForceChangeRate : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ForceChangeRate from nullable CentinewtonsPerSecond. + /// + public static ForceChangeRate? FromCentinewtonsPerSecond(QuantityValue? centinewtonspersecond) + { + return centinewtonspersecond.HasValue ? FromCentinewtonsPerSecond(centinewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable DecanewtonsPerMinute. + /// + public static ForceChangeRate? FromDecanewtonsPerMinute(QuantityValue? decanewtonsperminute) + { + return decanewtonsperminute.HasValue ? FromDecanewtonsPerMinute(decanewtonsperminute.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable DecanewtonsPerSecond. + /// + public static ForceChangeRate? FromDecanewtonsPerSecond(QuantityValue? decanewtonspersecond) + { + return decanewtonspersecond.HasValue ? FromDecanewtonsPerSecond(decanewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable DecinewtonsPerSecond. + /// + public static ForceChangeRate? FromDecinewtonsPerSecond(QuantityValue? decinewtonspersecond) + { + return decinewtonspersecond.HasValue ? FromDecinewtonsPerSecond(decinewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable KilonewtonsPerMinute. + /// + public static ForceChangeRate? FromKilonewtonsPerMinute(QuantityValue? kilonewtonsperminute) + { + return kilonewtonsperminute.HasValue ? FromKilonewtonsPerMinute(kilonewtonsperminute.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable KilonewtonsPerSecond. + /// + public static ForceChangeRate? FromKilonewtonsPerSecond(QuantityValue? kilonewtonspersecond) + { + return kilonewtonspersecond.HasValue ? FromKilonewtonsPerSecond(kilonewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable MicronewtonsPerSecond. + /// + public static ForceChangeRate? FromMicronewtonsPerSecond(QuantityValue? micronewtonspersecond) + { + return micronewtonspersecond.HasValue ? FromMicronewtonsPerSecond(micronewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable MillinewtonsPerSecond. + /// + public static ForceChangeRate? FromMillinewtonsPerSecond(QuantityValue? millinewtonspersecond) + { + return millinewtonspersecond.HasValue ? FromMillinewtonsPerSecond(millinewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable NanonewtonsPerSecond. + /// + public static ForceChangeRate? FromNanonewtonsPerSecond(QuantityValue? nanonewtonspersecond) + { + return nanonewtonspersecond.HasValue ? FromNanonewtonsPerSecond(nanonewtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable NewtonsPerMinute. + /// + public static ForceChangeRate? FromNewtonsPerMinute(QuantityValue? newtonsperminute) + { + return newtonsperminute.HasValue ? FromNewtonsPerMinute(newtonsperminute.Value) : default(ForceChangeRate?); + } + + /// + /// Get nullable ForceChangeRate from nullable NewtonsPerSecond. + /// + public static ForceChangeRate? FromNewtonsPerSecond(QuantityValue? newtonspersecond) + { + return newtonspersecond.HasValue ? FromNewtonsPerSecond(newtonspersecond.Value) : default(ForceChangeRate?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ForceChangeRate unit value. + public static ForceChangeRate? From(QuantityValue? value, ForceChangeRateUnit fromUnit) + { + return value.HasValue ? new ForceChangeRate((double)value.Value, fromUnit) : default(ForceChangeRate?); + } + + #endregion + + #region Arithmetic Operators + + public static ForceChangeRate operator -(ForceChangeRate right) + { + return new ForceChangeRate(-right.Value, right.Unit); + } + + public static ForceChangeRate operator +(ForceChangeRate left, ForceChangeRate right) + { + return new ForceChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ForceChangeRate operator -(ForceChangeRate left, ForceChangeRate right) + { + return new ForceChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ForceChangeRate operator *(double left, ForceChangeRate right) + { + return new ForceChangeRate(left * right.Value, right.Unit); + } + + public static ForceChangeRate operator *(ForceChangeRate left, double right) + { + return new ForceChangeRate(left.Value * right, left.Unit); + } + + public static ForceChangeRate operator /(ForceChangeRate left, double right) + { + return new ForceChangeRate(left.Value / right, left.Unit); + } + + public static double operator /(ForceChangeRate left, ForceChangeRate right) + { + return left.NewtonsPerSecond / right.NewtonsPerSecond; + } + + #endregion + + public static bool operator <=(ForceChangeRate left, ForceChangeRate right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ForceChangeRate left, ForceChangeRate right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ForceChangeRate left, ForceChangeRate right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ForceChangeRate left, ForceChangeRate right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ForceChangeRate left, ForceChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ForceChangeRate left, ForceChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ForcePerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ForcePerLength.NetFramework.g.cs index 79340f3067..be96275ab1 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ForcePerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ForcePerLength.NetFramework.g.cs @@ -59,5 +59,165 @@ public partial struct ForcePerLength : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ForcePerLength from nullable CentinewtonsPerMeter. + /// + public static ForcePerLength? FromCentinewtonsPerMeter(QuantityValue? centinewtonspermeter) + { + return centinewtonspermeter.HasValue ? FromCentinewtonsPerMeter(centinewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable DecinewtonsPerMeter. + /// + public static ForcePerLength? FromDecinewtonsPerMeter(QuantityValue? decinewtonspermeter) + { + return decinewtonspermeter.HasValue ? FromDecinewtonsPerMeter(decinewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable KilogramsForcePerMeter. + /// + public static ForcePerLength? FromKilogramsForcePerMeter(QuantityValue? kilogramsforcepermeter) + { + return kilogramsforcepermeter.HasValue ? FromKilogramsForcePerMeter(kilogramsforcepermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable KilonewtonsPerMeter. + /// + public static ForcePerLength? FromKilonewtonsPerMeter(QuantityValue? kilonewtonspermeter) + { + return kilonewtonspermeter.HasValue ? FromKilonewtonsPerMeter(kilonewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable MeganewtonsPerMeter. + /// + public static ForcePerLength? FromMeganewtonsPerMeter(QuantityValue? meganewtonspermeter) + { + return meganewtonspermeter.HasValue ? FromMeganewtonsPerMeter(meganewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable MicronewtonsPerMeter. + /// + public static ForcePerLength? FromMicronewtonsPerMeter(QuantityValue? micronewtonspermeter) + { + return micronewtonspermeter.HasValue ? FromMicronewtonsPerMeter(micronewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable MillinewtonsPerMeter. + /// + public static ForcePerLength? FromMillinewtonsPerMeter(QuantityValue? millinewtonspermeter) + { + return millinewtonspermeter.HasValue ? FromMillinewtonsPerMeter(millinewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable NanonewtonsPerMeter. + /// + public static ForcePerLength? FromNanonewtonsPerMeter(QuantityValue? nanonewtonspermeter) + { + return nanonewtonspermeter.HasValue ? FromNanonewtonsPerMeter(nanonewtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Get nullable ForcePerLength from nullable NewtonsPerMeter. + /// + public static ForcePerLength? FromNewtonsPerMeter(QuantityValue? newtonspermeter) + { + return newtonspermeter.HasValue ? FromNewtonsPerMeter(newtonspermeter.Value) : default(ForcePerLength?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ForcePerLength unit value. + public static ForcePerLength? From(QuantityValue? value, ForcePerLengthUnit fromUnit) + { + return value.HasValue ? new ForcePerLength((double)value.Value, fromUnit) : default(ForcePerLength?); + } + + #endregion + + #region Arithmetic Operators + + public static ForcePerLength operator -(ForcePerLength right) + { + return new ForcePerLength(-right.Value, right.Unit); + } + + public static ForcePerLength operator +(ForcePerLength left, ForcePerLength right) + { + return new ForcePerLength(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ForcePerLength operator -(ForcePerLength left, ForcePerLength right) + { + return new ForcePerLength(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ForcePerLength operator *(double left, ForcePerLength right) + { + return new ForcePerLength(left * right.Value, right.Unit); + } + + public static ForcePerLength operator *(ForcePerLength left, double right) + { + return new ForcePerLength(left.Value * right, left.Unit); + } + + public static ForcePerLength operator /(ForcePerLength left, double right) + { + return new ForcePerLength(left.Value / right, left.Unit); + } + + public static double operator /(ForcePerLength left, ForcePerLength right) + { + return left.NewtonsPerMeter / right.NewtonsPerMeter; + } + + #endregion + + public static bool operator <=(ForcePerLength left, ForcePerLength right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ForcePerLength left, ForcePerLength right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ForcePerLength left, ForcePerLength right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ForcePerLength left, ForcePerLength right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ForcePerLength left, ForcePerLength right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ForcePerLength left, ForcePerLength right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Frequency.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Frequency.NetFramework.g.cs index 6196d6d41f..8679574f40 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Frequency.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Frequency.NetFramework.g.cs @@ -59,5 +59,157 @@ public partial struct Frequency : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Frequency from nullable CyclesPerHour. + /// + public static Frequency? FromCyclesPerHour(QuantityValue? cyclesperhour) + { + return cyclesperhour.HasValue ? FromCyclesPerHour(cyclesperhour.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable CyclesPerMinute. + /// + public static Frequency? FromCyclesPerMinute(QuantityValue? cyclesperminute) + { + return cyclesperminute.HasValue ? FromCyclesPerMinute(cyclesperminute.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable Gigahertz. + /// + public static Frequency? FromGigahertz(QuantityValue? gigahertz) + { + return gigahertz.HasValue ? FromGigahertz(gigahertz.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable Hertz. + /// + public static Frequency? FromHertz(QuantityValue? hertz) + { + return hertz.HasValue ? FromHertz(hertz.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable Kilohertz. + /// + public static Frequency? FromKilohertz(QuantityValue? kilohertz) + { + return kilohertz.HasValue ? FromKilohertz(kilohertz.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable Megahertz. + /// + public static Frequency? FromMegahertz(QuantityValue? megahertz) + { + return megahertz.HasValue ? FromMegahertz(megahertz.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable RadiansPerSecond. + /// + public static Frequency? FromRadiansPerSecond(QuantityValue? radianspersecond) + { + return radianspersecond.HasValue ? FromRadiansPerSecond(radianspersecond.Value) : default(Frequency?); + } + + /// + /// Get nullable Frequency from nullable Terahertz. + /// + public static Frequency? FromTerahertz(QuantityValue? terahertz) + { + return terahertz.HasValue ? FromTerahertz(terahertz.Value) : default(Frequency?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Frequency unit value. + public static Frequency? From(QuantityValue? value, FrequencyUnit fromUnit) + { + return value.HasValue ? new Frequency((double)value.Value, fromUnit) : default(Frequency?); + } + + #endregion + + #region Arithmetic Operators + + public static Frequency operator -(Frequency right) + { + return new Frequency(-right.Value, right.Unit); + } + + public static Frequency operator +(Frequency left, Frequency right) + { + return new Frequency(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Frequency operator -(Frequency left, Frequency right) + { + return new Frequency(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Frequency operator *(double left, Frequency right) + { + return new Frequency(left * right.Value, right.Unit); + } + + public static Frequency operator *(Frequency left, double right) + { + return new Frequency(left.Value * right, left.Unit); + } + + public static Frequency operator /(Frequency left, double right) + { + return new Frequency(left.Value / right, left.Unit); + } + + public static double operator /(Frequency left, Frequency right) + { + return left.Hertz / right.Hertz; + } + + #endregion + + public static bool operator <=(Frequency left, Frequency right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Frequency left, Frequency right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Frequency left, Frequency right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Frequency left, Frequency right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Frequency left, Frequency right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Frequency left, Frequency right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatFlux.NetFramework.g.cs index 2e3f8f52bc..6a65832ca5 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatFlux.NetFramework.g.cs @@ -59,5 +59,221 @@ public partial struct HeatFlux : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable HeatFlux from nullable BtusPerHourSquareFoot. + /// + public static HeatFlux? FromBtusPerHourSquareFoot(QuantityValue? btusperhoursquarefoot) + { + return btusperhoursquarefoot.HasValue ? FromBtusPerHourSquareFoot(btusperhoursquarefoot.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable BtusPerMinuteSquareFoot. + /// + public static HeatFlux? FromBtusPerMinuteSquareFoot(QuantityValue? btusperminutesquarefoot) + { + return btusperminutesquarefoot.HasValue ? FromBtusPerMinuteSquareFoot(btusperminutesquarefoot.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable BtusPerSecondSquareFoot. + /// + public static HeatFlux? FromBtusPerSecondSquareFoot(QuantityValue? btuspersecondsquarefoot) + { + return btuspersecondsquarefoot.HasValue ? FromBtusPerSecondSquareFoot(btuspersecondsquarefoot.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable BtusPerSecondSquareInch. + /// + public static HeatFlux? FromBtusPerSecondSquareInch(QuantityValue? btuspersecondsquareinch) + { + return btuspersecondsquareinch.HasValue ? FromBtusPerSecondSquareInch(btuspersecondsquareinch.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable CaloriesPerSecondSquareCentimeter. + /// + public static HeatFlux? FromCaloriesPerSecondSquareCentimeter(QuantityValue? caloriespersecondsquarecentimeter) + { + return caloriespersecondsquarecentimeter.HasValue ? FromCaloriesPerSecondSquareCentimeter(caloriespersecondsquarecentimeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable CentiwattsPerSquareMeter. + /// + public static HeatFlux? FromCentiwattsPerSquareMeter(QuantityValue? centiwattspersquaremeter) + { + return centiwattspersquaremeter.HasValue ? FromCentiwattsPerSquareMeter(centiwattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable DeciwattsPerSquareMeter. + /// + public static HeatFlux? FromDeciwattsPerSquareMeter(QuantityValue? deciwattspersquaremeter) + { + return deciwattspersquaremeter.HasValue ? FromDeciwattsPerSquareMeter(deciwattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable KilocaloriesPerHourSquareMeter. + /// + public static HeatFlux? FromKilocaloriesPerHourSquareMeter(QuantityValue? kilocaloriesperhoursquaremeter) + { + return kilocaloriesperhoursquaremeter.HasValue ? FromKilocaloriesPerHourSquareMeter(kilocaloriesperhoursquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable KilocaloriesPerSecondSquareCentimeter. + /// + public static HeatFlux? FromKilocaloriesPerSecondSquareCentimeter(QuantityValue? kilocaloriespersecondsquarecentimeter) + { + return kilocaloriespersecondsquarecentimeter.HasValue ? FromKilocaloriesPerSecondSquareCentimeter(kilocaloriespersecondsquarecentimeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable KilowattsPerSquareMeter. + /// + public static HeatFlux? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) + { + return kilowattspersquaremeter.HasValue ? FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable MicrowattsPerSquareMeter. + /// + public static HeatFlux? FromMicrowattsPerSquareMeter(QuantityValue? microwattspersquaremeter) + { + return microwattspersquaremeter.HasValue ? FromMicrowattsPerSquareMeter(microwattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable MilliwattsPerSquareMeter. + /// + public static HeatFlux? FromMilliwattsPerSquareMeter(QuantityValue? milliwattspersquaremeter) + { + return milliwattspersquaremeter.HasValue ? FromMilliwattsPerSquareMeter(milliwattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable NanowattsPerSquareMeter. + /// + public static HeatFlux? FromNanowattsPerSquareMeter(QuantityValue? nanowattspersquaremeter) + { + return nanowattspersquaremeter.HasValue ? FromNanowattsPerSquareMeter(nanowattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable WattsPerSquareFoot. + /// + public static HeatFlux? FromWattsPerSquareFoot(QuantityValue? wattspersquarefoot) + { + return wattspersquarefoot.HasValue ? FromWattsPerSquareFoot(wattspersquarefoot.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable WattsPerSquareInch. + /// + public static HeatFlux? FromWattsPerSquareInch(QuantityValue? wattspersquareinch) + { + return wattspersquareinch.HasValue ? FromWattsPerSquareInch(wattspersquareinch.Value) : default(HeatFlux?); + } + + /// + /// Get nullable HeatFlux from nullable WattsPerSquareMeter. + /// + public static HeatFlux? FromWattsPerSquareMeter(QuantityValue? wattspersquaremeter) + { + return wattspersquaremeter.HasValue ? FromWattsPerSquareMeter(wattspersquaremeter.Value) : default(HeatFlux?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// HeatFlux unit value. + public static HeatFlux? From(QuantityValue? value, HeatFluxUnit fromUnit) + { + return value.HasValue ? new HeatFlux((double)value.Value, fromUnit) : default(HeatFlux?); + } + + #endregion + + #region Arithmetic Operators + + public static HeatFlux operator -(HeatFlux right) + { + return new HeatFlux(-right.Value, right.Unit); + } + + public static HeatFlux operator +(HeatFlux left, HeatFlux right) + { + return new HeatFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static HeatFlux operator -(HeatFlux left, HeatFlux right) + { + return new HeatFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static HeatFlux operator *(double left, HeatFlux right) + { + return new HeatFlux(left * right.Value, right.Unit); + } + + public static HeatFlux operator *(HeatFlux left, double right) + { + return new HeatFlux(left.Value * right, left.Unit); + } + + public static HeatFlux operator /(HeatFlux left, double right) + { + return new HeatFlux(left.Value / right, left.Unit); + } + + public static double operator /(HeatFlux left, HeatFlux right) + { + return left.WattsPerSquareMeter / right.WattsPerSquareMeter; + } + + #endregion + + public static bool operator <=(HeatFlux left, HeatFlux right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(HeatFlux left, HeatFlux right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(HeatFlux left, HeatFlux right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(HeatFlux left, HeatFlux right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(HeatFlux left, HeatFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(HeatFlux left, HeatFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatTransferCoefficient.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatTransferCoefficient.NetFramework.g.cs index 56cddc9e6b..75c2787e37 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatTransferCoefficient.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/HeatTransferCoefficient.NetFramework.g.cs @@ -59,5 +59,109 @@ public partial struct HeatTransferCoefficient : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterCelsius. + /// + public static HeatTransferCoefficient? FromWattsPerSquareMeterCelsius(QuantityValue? wattspersquaremetercelsius) + { + return wattspersquaremetercelsius.HasValue ? FromWattsPerSquareMeterCelsius(wattspersquaremetercelsius.Value) : default(HeatTransferCoefficient?); + } + + /// + /// Get nullable HeatTransferCoefficient from nullable WattsPerSquareMeterKelvin. + /// + public static HeatTransferCoefficient? FromWattsPerSquareMeterKelvin(QuantityValue? wattspersquaremeterkelvin) + { + return wattspersquaremeterkelvin.HasValue ? FromWattsPerSquareMeterKelvin(wattspersquaremeterkelvin.Value) : default(HeatTransferCoefficient?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// HeatTransferCoefficient unit value. + public static HeatTransferCoefficient? From(QuantityValue? value, HeatTransferCoefficientUnit fromUnit) + { + return value.HasValue ? new HeatTransferCoefficient((double)value.Value, fromUnit) : default(HeatTransferCoefficient?); + } + + #endregion + + #region Arithmetic Operators + + public static HeatTransferCoefficient operator -(HeatTransferCoefficient right) + { + return new HeatTransferCoefficient(-right.Value, right.Unit); + } + + public static HeatTransferCoefficient operator +(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return new HeatTransferCoefficient(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static HeatTransferCoefficient operator -(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return new HeatTransferCoefficient(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static HeatTransferCoefficient operator *(double left, HeatTransferCoefficient right) + { + return new HeatTransferCoefficient(left * right.Value, right.Unit); + } + + public static HeatTransferCoefficient operator *(HeatTransferCoefficient left, double right) + { + return new HeatTransferCoefficient(left.Value * right, left.Unit); + } + + public static HeatTransferCoefficient operator /(HeatTransferCoefficient left, double right) + { + return new HeatTransferCoefficient(left.Value / right, left.Unit); + } + + public static double operator /(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.WattsPerSquareMeterKelvin / right.WattsPerSquareMeterKelvin; + } + + #endregion + + public static bool operator <=(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(HeatTransferCoefficient left, HeatTransferCoefficient right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Illuminance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Illuminance.NetFramework.g.cs index 2f91267460..329b1c269e 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Illuminance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Illuminance.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct Illuminance : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Illuminance from nullable Kilolux. + /// + public static Illuminance? FromKilolux(QuantityValue? kilolux) + { + return kilolux.HasValue ? FromKilolux(kilolux.Value) : default(Illuminance?); + } + + /// + /// Get nullable Illuminance from nullable Lux. + /// + public static Illuminance? FromLux(QuantityValue? lux) + { + return lux.HasValue ? FromLux(lux.Value) : default(Illuminance?); + } + + /// + /// Get nullable Illuminance from nullable Megalux. + /// + public static Illuminance? FromMegalux(QuantityValue? megalux) + { + return megalux.HasValue ? FromMegalux(megalux.Value) : default(Illuminance?); + } + + /// + /// Get nullable Illuminance from nullable Millilux. + /// + public static Illuminance? FromMillilux(QuantityValue? millilux) + { + return millilux.HasValue ? FromMillilux(millilux.Value) : default(Illuminance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Illuminance unit value. + public static Illuminance? From(QuantityValue? value, IlluminanceUnit fromUnit) + { + return value.HasValue ? new Illuminance((double)value.Value, fromUnit) : default(Illuminance?); + } + + #endregion + + #region Arithmetic Operators + + public static Illuminance operator -(Illuminance right) + { + return new Illuminance(-right.Value, right.Unit); + } + + public static Illuminance operator +(Illuminance left, Illuminance right) + { + return new Illuminance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Illuminance operator -(Illuminance left, Illuminance right) + { + return new Illuminance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Illuminance operator *(double left, Illuminance right) + { + return new Illuminance(left * right.Value, right.Unit); + } + + public static Illuminance operator *(Illuminance left, double right) + { + return new Illuminance(left.Value * right, left.Unit); + } + + public static Illuminance operator /(Illuminance left, double right) + { + return new Illuminance(left.Value / right, left.Unit); + } + + public static double operator /(Illuminance left, Illuminance right) + { + return left.Lux / right.Lux; + } + + #endregion + + public static bool operator <=(Illuminance left, Illuminance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Illuminance left, Illuminance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Illuminance left, Illuminance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Illuminance left, Illuminance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Illuminance left, Illuminance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Illuminance left, Illuminance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Information.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Information.NetFramework.g.cs index 51296d60d0..76dbb81ac8 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Information.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Information.NetFramework.g.cs @@ -59,5 +59,299 @@ public partial struct Information : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public decimal Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Information from nullable Bits. + /// + public static Information? FromBits(QuantityValue? bits) + { + return bits.HasValue ? FromBits(bits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Bytes. + /// + public static Information? FromBytes(QuantityValue? bytes) + { + return bytes.HasValue ? FromBytes(bytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Exabits. + /// + public static Information? FromExabits(QuantityValue? exabits) + { + return exabits.HasValue ? FromExabits(exabits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Exabytes. + /// + public static Information? FromExabytes(QuantityValue? exabytes) + { + return exabytes.HasValue ? FromExabytes(exabytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Exbibits. + /// + public static Information? FromExbibits(QuantityValue? exbibits) + { + return exbibits.HasValue ? FromExbibits(exbibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Exbibytes. + /// + public static Information? FromExbibytes(QuantityValue? exbibytes) + { + return exbibytes.HasValue ? FromExbibytes(exbibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Gibibits. + /// + public static Information? FromGibibits(QuantityValue? gibibits) + { + return gibibits.HasValue ? FromGibibits(gibibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Gibibytes. + /// + public static Information? FromGibibytes(QuantityValue? gibibytes) + { + return gibibytes.HasValue ? FromGibibytes(gibibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Gigabits. + /// + public static Information? FromGigabits(QuantityValue? gigabits) + { + return gigabits.HasValue ? FromGigabits(gigabits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Gigabytes. + /// + public static Information? FromGigabytes(QuantityValue? gigabytes) + { + return gigabytes.HasValue ? FromGigabytes(gigabytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Kibibits. + /// + public static Information? FromKibibits(QuantityValue? kibibits) + { + return kibibits.HasValue ? FromKibibits(kibibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Kibibytes. + /// + public static Information? FromKibibytes(QuantityValue? kibibytes) + { + return kibibytes.HasValue ? FromKibibytes(kibibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Kilobits. + /// + public static Information? FromKilobits(QuantityValue? kilobits) + { + return kilobits.HasValue ? FromKilobits(kilobits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Kilobytes. + /// + public static Information? FromKilobytes(QuantityValue? kilobytes) + { + return kilobytes.HasValue ? FromKilobytes(kilobytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Mebibits. + /// + public static Information? FromMebibits(QuantityValue? mebibits) + { + return mebibits.HasValue ? FromMebibits(mebibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Mebibytes. + /// + public static Information? FromMebibytes(QuantityValue? mebibytes) + { + return mebibytes.HasValue ? FromMebibytes(mebibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Megabits. + /// + public static Information? FromMegabits(QuantityValue? megabits) + { + return megabits.HasValue ? FromMegabits(megabits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Megabytes. + /// + public static Information? FromMegabytes(QuantityValue? megabytes) + { + return megabytes.HasValue ? FromMegabytes(megabytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Pebibits. + /// + public static Information? FromPebibits(QuantityValue? pebibits) + { + return pebibits.HasValue ? FromPebibits(pebibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Pebibytes. + /// + public static Information? FromPebibytes(QuantityValue? pebibytes) + { + return pebibytes.HasValue ? FromPebibytes(pebibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Petabits. + /// + public static Information? FromPetabits(QuantityValue? petabits) + { + return petabits.HasValue ? FromPetabits(petabits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Petabytes. + /// + public static Information? FromPetabytes(QuantityValue? petabytes) + { + return petabytes.HasValue ? FromPetabytes(petabytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Tebibits. + /// + public static Information? FromTebibits(QuantityValue? tebibits) + { + return tebibits.HasValue ? FromTebibits(tebibits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Tebibytes. + /// + public static Information? FromTebibytes(QuantityValue? tebibytes) + { + return tebibytes.HasValue ? FromTebibytes(tebibytes.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Terabits. + /// + public static Information? FromTerabits(QuantityValue? terabits) + { + return terabits.HasValue ? FromTerabits(terabits.Value) : default(Information?); + } + + /// + /// Get nullable Information from nullable Terabytes. + /// + public static Information? FromTerabytes(QuantityValue? terabytes) + { + return terabytes.HasValue ? FromTerabytes(terabytes.Value) : default(Information?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Information unit value. + public static Information? From(QuantityValue? value, InformationUnit fromUnit) + { + return value.HasValue ? new Information((decimal)value.Value, fromUnit) : default(Information?); + } + + #endregion + + #region Arithmetic Operators + + public static Information operator -(Information right) + { + return new Information(-right.Value, right.Unit); + } + + public static Information operator +(Information left, Information right) + { + return new Information(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Information operator -(Information left, Information right) + { + return new Information(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Information operator *(decimal left, Information right) + { + return new Information(left * right.Value, right.Unit); + } + + public static Information operator *(Information left, decimal right) + { + return new Information(left.Value * right, left.Unit); + } + + public static Information operator /(Information left, decimal right) + { + return new Information(left.Value / right, left.Unit); + } + + public static double operator /(Information left, Information right) + { + return left.Bits / right.Bits; + } + + #endregion + + public static bool operator <=(Information left, Information right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Information left, Information right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Information left, Information right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Information left, Information right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + public static bool operator ==(Information left, Information right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + public static bool operator !=(Information left, Information right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiance.NetFramework.g.cs index 87beb3894e..04d37a56e3 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiance.NetFramework.g.cs @@ -59,5 +59,109 @@ public partial struct Irradiance : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Irradiance from nullable KilowattsPerSquareMeter. + /// + public static Irradiance? FromKilowattsPerSquareMeter(QuantityValue? kilowattspersquaremeter) + { + return kilowattspersquaremeter.HasValue ? FromKilowattsPerSquareMeter(kilowattspersquaremeter.Value) : default(Irradiance?); + } + + /// + /// Get nullable Irradiance from nullable WattsPerSquareMeter. + /// + public static Irradiance? FromWattsPerSquareMeter(QuantityValue? wattspersquaremeter) + { + return wattspersquaremeter.HasValue ? FromWattsPerSquareMeter(wattspersquaremeter.Value) : default(Irradiance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Irradiance unit value. + public static Irradiance? From(QuantityValue? value, IrradianceUnit fromUnit) + { + return value.HasValue ? new Irradiance((double)value.Value, fromUnit) : default(Irradiance?); + } + + #endregion + + #region Arithmetic Operators + + public static Irradiance operator -(Irradiance right) + { + return new Irradiance(-right.Value, right.Unit); + } + + public static Irradiance operator +(Irradiance left, Irradiance right) + { + return new Irradiance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Irradiance operator -(Irradiance left, Irradiance right) + { + return new Irradiance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Irradiance operator *(double left, Irradiance right) + { + return new Irradiance(left * right.Value, right.Unit); + } + + public static Irradiance operator *(Irradiance left, double right) + { + return new Irradiance(left.Value * right, left.Unit); + } + + public static Irradiance operator /(Irradiance left, double right) + { + return new Irradiance(left.Value / right, left.Unit); + } + + public static double operator /(Irradiance left, Irradiance right) + { + return left.WattsPerSquareMeter / right.WattsPerSquareMeter; + } + + #endregion + + public static bool operator <=(Irradiance left, Irradiance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Irradiance left, Irradiance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Irradiance left, Irradiance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Irradiance left, Irradiance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Irradiance left, Irradiance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Irradiance left, Irradiance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiation.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiation.NetFramework.g.cs index 110897688c..68155980b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiation.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Irradiation.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct Irradiation : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Irradiation from nullable JoulesPerSquareMeter. + /// + public static Irradiation? FromJoulesPerSquareMeter(QuantityValue? joulespersquaremeter) + { + return joulespersquaremeter.HasValue ? FromJoulesPerSquareMeter(joulespersquaremeter.Value) : default(Irradiation?); + } + + /// + /// Get nullable Irradiation from nullable KilowattHoursPerSquareMeter. + /// + public static Irradiation? FromKilowattHoursPerSquareMeter(QuantityValue? kilowatthourspersquaremeter) + { + return kilowatthourspersquaremeter.HasValue ? FromKilowattHoursPerSquareMeter(kilowatthourspersquaremeter.Value) : default(Irradiation?); + } + + /// + /// Get nullable Irradiation from nullable WattHoursPerSquareMeter. + /// + public static Irradiation? FromWattHoursPerSquareMeter(QuantityValue? watthourspersquaremeter) + { + return watthourspersquaremeter.HasValue ? FromWattHoursPerSquareMeter(watthourspersquaremeter.Value) : default(Irradiation?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Irradiation unit value. + public static Irradiation? From(QuantityValue? value, IrradiationUnit fromUnit) + { + return value.HasValue ? new Irradiation((double)value.Value, fromUnit) : default(Irradiation?); + } + + #endregion + + #region Arithmetic Operators + + public static Irradiation operator -(Irradiation right) + { + return new Irradiation(-right.Value, right.Unit); + } + + public static Irradiation operator +(Irradiation left, Irradiation right) + { + return new Irradiation(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Irradiation operator -(Irradiation left, Irradiation right) + { + return new Irradiation(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Irradiation operator *(double left, Irradiation right) + { + return new Irradiation(left * right.Value, right.Unit); + } + + public static Irradiation operator *(Irradiation left, double right) + { + return new Irradiation(left.Value * right, left.Unit); + } + + public static Irradiation operator /(Irradiation left, double right) + { + return new Irradiation(left.Value / right, left.Unit); + } + + public static double operator /(Irradiation left, Irradiation right) + { + return left.JoulesPerSquareMeter / right.JoulesPerSquareMeter; + } + + #endregion + + public static bool operator <=(Irradiation left, Irradiation right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Irradiation left, Irradiation right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Irradiation left, Irradiation right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Irradiation left, Irradiation right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Irradiation left, Irradiation right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Irradiation left, Irradiation right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/KinematicViscosity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/KinematicViscosity.NetFramework.g.cs index 6a0cfe27ed..b69816c5d4 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/KinematicViscosity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/KinematicViscosity.NetFramework.g.cs @@ -59,5 +59,157 @@ public partial struct KinematicViscosity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable KinematicViscosity from nullable Centistokes. + /// + public static KinematicViscosity? FromCentistokes(QuantityValue? centistokes) + { + return centistokes.HasValue ? FromCentistokes(centistokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Decistokes. + /// + public static KinematicViscosity? FromDecistokes(QuantityValue? decistokes) + { + return decistokes.HasValue ? FromDecistokes(decistokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Kilostokes. + /// + public static KinematicViscosity? FromKilostokes(QuantityValue? kilostokes) + { + return kilostokes.HasValue ? FromKilostokes(kilostokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Microstokes. + /// + public static KinematicViscosity? FromMicrostokes(QuantityValue? microstokes) + { + return microstokes.HasValue ? FromMicrostokes(microstokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Millistokes. + /// + public static KinematicViscosity? FromMillistokes(QuantityValue? millistokes) + { + return millistokes.HasValue ? FromMillistokes(millistokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Nanostokes. + /// + public static KinematicViscosity? FromNanostokes(QuantityValue? nanostokes) + { + return nanostokes.HasValue ? FromNanostokes(nanostokes.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable SquareMetersPerSecond. + /// + public static KinematicViscosity? FromSquareMetersPerSecond(QuantityValue? squaremeterspersecond) + { + return squaremeterspersecond.HasValue ? FromSquareMetersPerSecond(squaremeterspersecond.Value) : default(KinematicViscosity?); + } + + /// + /// Get nullable KinematicViscosity from nullable Stokes. + /// + public static KinematicViscosity? FromStokes(QuantityValue? stokes) + { + return stokes.HasValue ? FromStokes(stokes.Value) : default(KinematicViscosity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// KinematicViscosity unit value. + public static KinematicViscosity? From(QuantityValue? value, KinematicViscosityUnit fromUnit) + { + return value.HasValue ? new KinematicViscosity((double)value.Value, fromUnit) : default(KinematicViscosity?); + } + + #endregion + + #region Arithmetic Operators + + public static KinematicViscosity operator -(KinematicViscosity right) + { + return new KinematicViscosity(-right.Value, right.Unit); + } + + public static KinematicViscosity operator +(KinematicViscosity left, KinematicViscosity right) + { + return new KinematicViscosity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static KinematicViscosity operator -(KinematicViscosity left, KinematicViscosity right) + { + return new KinematicViscosity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static KinematicViscosity operator *(double left, KinematicViscosity right) + { + return new KinematicViscosity(left * right.Value, right.Unit); + } + + public static KinematicViscosity operator *(KinematicViscosity left, double right) + { + return new KinematicViscosity(left.Value * right, left.Unit); + } + + public static KinematicViscosity operator /(KinematicViscosity left, double right) + { + return new KinematicViscosity(left.Value / right, left.Unit); + } + + public static double operator /(KinematicViscosity left, KinematicViscosity right) + { + return left.SquareMetersPerSecond / right.SquareMetersPerSecond; + } + + #endregion + + public static bool operator <=(KinematicViscosity left, KinematicViscosity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(KinematicViscosity left, KinematicViscosity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(KinematicViscosity left, KinematicViscosity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(KinematicViscosity left, KinematicViscosity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(KinematicViscosity left, KinematicViscosity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(KinematicViscosity left, KinematicViscosity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/LapseRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/LapseRate.NetFramework.g.cs index 46720ef3b7..33926c916f 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/LapseRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/LapseRate.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct LapseRate : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable LapseRate from nullable DegreesCelciusPerKilometer. + /// + public static LapseRate? FromDegreesCelciusPerKilometer(QuantityValue? degreescelciusperkilometer) + { + return degreescelciusperkilometer.HasValue ? FromDegreesCelciusPerKilometer(degreescelciusperkilometer.Value) : default(LapseRate?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LapseRate unit value. + public static LapseRate? From(QuantityValue? value, LapseRateUnit fromUnit) + { + return value.HasValue ? new LapseRate((double)value.Value, fromUnit) : default(LapseRate?); + } + + #endregion + + #region Arithmetic Operators + + public static LapseRate operator -(LapseRate right) + { + return new LapseRate(-right.Value, right.Unit); + } + + public static LapseRate operator +(LapseRate left, LapseRate right) + { + return new LapseRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LapseRate operator -(LapseRate left, LapseRate right) + { + return new LapseRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LapseRate operator *(double left, LapseRate right) + { + return new LapseRate(left * right.Value, right.Unit); + } + + public static LapseRate operator *(LapseRate left, double right) + { + return new LapseRate(left.Value * right, left.Unit); + } + + public static LapseRate operator /(LapseRate left, double right) + { + return new LapseRate(left.Value / right, left.Unit); + } + + public static double operator /(LapseRate left, LapseRate right) + { + return left.DegreesCelciusPerKilometer / right.DegreesCelciusPerKilometer; + } + + #endregion + + public static bool operator <=(LapseRate left, LapseRate right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(LapseRate left, LapseRate right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(LapseRate left, LapseRate right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(LapseRate left, LapseRate right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(LapseRate left, LapseRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(LapseRate left, LapseRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Length.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Length.NetFramework.g.cs index f51f24a96d..8efd5b57f8 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Length.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Length.NetFramework.g.cs @@ -59,5 +59,269 @@ public partial struct Length : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Length from nullable Centimeters. + /// + public static Length? FromCentimeters(QuantityValue? centimeters) + { + return centimeters.HasValue ? FromCentimeters(centimeters.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Decimeters. + /// + public static Length? FromDecimeters(QuantityValue? decimeters) + { + return decimeters.HasValue ? FromDecimeters(decimeters.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable DtpPicas. + /// + public static Length? FromDtpPicas(QuantityValue? dtppicas) + { + return dtppicas.HasValue ? FromDtpPicas(dtppicas.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable DtpPoints. + /// + public static Length? FromDtpPoints(QuantityValue? dtppoints) + { + return dtppoints.HasValue ? FromDtpPoints(dtppoints.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Fathoms. + /// + public static Length? FromFathoms(QuantityValue? fathoms) + { + return fathoms.HasValue ? FromFathoms(fathoms.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Feet. + /// + public static Length? FromFeet(QuantityValue? feet) + { + return feet.HasValue ? FromFeet(feet.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Inches. + /// + public static Length? FromInches(QuantityValue? inches) + { + return inches.HasValue ? FromInches(inches.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Kilometers. + /// + public static Length? FromKilometers(QuantityValue? kilometers) + { + return kilometers.HasValue ? FromKilometers(kilometers.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Meters. + /// + public static Length? FromMeters(QuantityValue? meters) + { + return meters.HasValue ? FromMeters(meters.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Microinches. + /// + public static Length? FromMicroinches(QuantityValue? microinches) + { + return microinches.HasValue ? FromMicroinches(microinches.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Micrometers. + /// + public static Length? FromMicrometers(QuantityValue? micrometers) + { + return micrometers.HasValue ? FromMicrometers(micrometers.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Mils. + /// + public static Length? FromMils(QuantityValue? mils) + { + return mils.HasValue ? FromMils(mils.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Miles. + /// + public static Length? FromMiles(QuantityValue? miles) + { + return miles.HasValue ? FromMiles(miles.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Millimeters. + /// + public static Length? FromMillimeters(QuantityValue? millimeters) + { + return millimeters.HasValue ? FromMillimeters(millimeters.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Nanometers. + /// + public static Length? FromNanometers(QuantityValue? nanometers) + { + return nanometers.HasValue ? FromNanometers(nanometers.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable NauticalMiles. + /// + public static Length? FromNauticalMiles(QuantityValue? nauticalmiles) + { + return nauticalmiles.HasValue ? FromNauticalMiles(nauticalmiles.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable PrinterPicas. + /// + public static Length? FromPrinterPicas(QuantityValue? printerpicas) + { + return printerpicas.HasValue ? FromPrinterPicas(printerpicas.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable PrinterPoints. + /// + public static Length? FromPrinterPoints(QuantityValue? printerpoints) + { + return printerpoints.HasValue ? FromPrinterPoints(printerpoints.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Shackles. + /// + public static Length? FromShackles(QuantityValue? shackles) + { + return shackles.HasValue ? FromShackles(shackles.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Twips. + /// + public static Length? FromTwips(QuantityValue? twips) + { + return twips.HasValue ? FromTwips(twips.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable UsSurveyFeet. + /// + public static Length? FromUsSurveyFeet(QuantityValue? ussurveyfeet) + { + return ussurveyfeet.HasValue ? FromUsSurveyFeet(ussurveyfeet.Value) : default(Length?); + } + + /// + /// Get nullable Length from nullable Yards. + /// + public static Length? FromYards(QuantityValue? yards) + { + return yards.HasValue ? FromYards(yards.Value) : default(Length?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Length unit value. + public static Length? From(QuantityValue? value, LengthUnit fromUnit) + { + return value.HasValue ? new Length((double)value.Value, fromUnit) : default(Length?); + } + + #endregion + + #region Arithmetic Operators + + public static Length operator -(Length right) + { + return new Length(-right.Value, right.Unit); + } + + public static Length operator +(Length left, Length right) + { + return new Length(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Length operator -(Length left, Length right) + { + return new Length(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Length operator *(double left, Length right) + { + return new Length(left * right.Value, right.Unit); + } + + public static Length operator *(Length left, double right) + { + return new Length(left.Value * right, left.Unit); + } + + public static Length operator /(Length left, double right) + { + return new Length(left.Value / right, left.Unit); + } + + public static double operator /(Length left, Length right) + { + return left.Meters / right.Meters; + } + + #endregion + + public static bool operator <=(Length left, Length right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Length left, Length right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Length left, Length right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Length left, Length right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Length left, Length right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Length left, Length right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Level.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Level.NetFramework.g.cs index afa0d80984..b19a0a03f0 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Level.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Level.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct Level : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Level from nullable Decibels. + /// + public static Level? FromDecibels(QuantityValue? decibels) + { + return decibels.HasValue ? FromDecibels(decibels.Value) : default(Level?); + } + + /// + /// Get nullable Level from nullable Nepers. + /// + public static Level? FromNepers(QuantityValue? nepers) + { + return nepers.HasValue ? FromNepers(nepers.Value) : default(Level?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Level unit value. + public static Level? From(QuantityValue? value, LevelUnit fromUnit) + { + return value.HasValue ? new Level((double)value.Value, fromUnit) : default(Level?); + } + + #endregion + + #region Logarithmic Arithmetic Operators + + public static Level operator -(Level right) + { + return new Level(-right.Value, right.Unit); + } + + public static Level operator +(Level left, Level right) + { + // Logarithmic addition + // Formula: 10*log10(10^(x/10) + 10^(y/10)) + return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); + } + + public static Level operator -(Level left, Level right) + { + // Logarithmic subtraction + // Formula: 10*log10(10^(x/10) - 10^(y/10)) + return new Level(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); + } + + public static Level operator *(double left, Level right) + { + // Logarithmic multiplication = addition + return new Level(left + right.Value, right.Unit); + } + + public static Level operator *(Level left, double right) + { + // Logarithmic multiplication = addition + return new Level(left.Value + (double)right, left.Unit); + } + + public static Level operator /(Level left, double right) + { + // Logarithmic division = subtraction + return new Level(left.Value - (double)right, left.Unit); + } + + public static double operator /(Level left, Level right) + { + // Logarithmic division = subtraction + return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); + } + + #endregion + + public static bool operator <=(Level left, Level right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Level left, Level right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Level left, Level right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Level left, Level right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Level left, Level right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Level left, Level right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/LinearDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/LinearDensity.NetFramework.g.cs index 2f459e4ffd..64075cb7c0 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/LinearDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/LinearDensity.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct LinearDensity : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable LinearDensity from nullable GramsPerMeter. + /// + public static LinearDensity? FromGramsPerMeter(QuantityValue? gramspermeter) + { + return gramspermeter.HasValue ? FromGramsPerMeter(gramspermeter.Value) : default(LinearDensity?); + } + + /// + /// Get nullable LinearDensity from nullable KilogramsPerMeter. + /// + public static LinearDensity? FromKilogramsPerMeter(QuantityValue? kilogramspermeter) + { + return kilogramspermeter.HasValue ? FromKilogramsPerMeter(kilogramspermeter.Value) : default(LinearDensity?); + } + + /// + /// Get nullable LinearDensity from nullable PoundsPerFoot. + /// + public static LinearDensity? FromPoundsPerFoot(QuantityValue? poundsperfoot) + { + return poundsperfoot.HasValue ? FromPoundsPerFoot(poundsperfoot.Value) : default(LinearDensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LinearDensity unit value. + public static LinearDensity? From(QuantityValue? value, LinearDensityUnit fromUnit) + { + return value.HasValue ? new LinearDensity((double)value.Value, fromUnit) : default(LinearDensity?); + } + + #endregion + + #region Arithmetic Operators + + public static LinearDensity operator -(LinearDensity right) + { + return new LinearDensity(-right.Value, right.Unit); + } + + public static LinearDensity operator +(LinearDensity left, LinearDensity right) + { + return new LinearDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LinearDensity operator -(LinearDensity left, LinearDensity right) + { + return new LinearDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LinearDensity operator *(double left, LinearDensity right) + { + return new LinearDensity(left * right.Value, right.Unit); + } + + public static LinearDensity operator *(LinearDensity left, double right) + { + return new LinearDensity(left.Value * right, left.Unit); + } + + public static LinearDensity operator /(LinearDensity left, double right) + { + return new LinearDensity(left.Value / right, left.Unit); + } + + public static double operator /(LinearDensity left, LinearDensity right) + { + return left.KilogramsPerMeter / right.KilogramsPerMeter; + } + + #endregion + + public static bool operator <=(LinearDensity left, LinearDensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(LinearDensity left, LinearDensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(LinearDensity left, LinearDensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(LinearDensity left, LinearDensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(LinearDensity left, LinearDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(LinearDensity left, LinearDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousFlux.NetFramework.g.cs index bf4b5c9ca3..b1460cc6bd 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousFlux.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct LuminousFlux : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable LuminousFlux from nullable Lumens. + /// + public static LuminousFlux? FromLumens(QuantityValue? lumens) + { + return lumens.HasValue ? FromLumens(lumens.Value) : default(LuminousFlux?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LuminousFlux unit value. + public static LuminousFlux? From(QuantityValue? value, LuminousFluxUnit fromUnit) + { + return value.HasValue ? new LuminousFlux((double)value.Value, fromUnit) : default(LuminousFlux?); + } + + #endregion + + #region Arithmetic Operators + + public static LuminousFlux operator -(LuminousFlux right) + { + return new LuminousFlux(-right.Value, right.Unit); + } + + public static LuminousFlux operator +(LuminousFlux left, LuminousFlux right) + { + return new LuminousFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LuminousFlux operator -(LuminousFlux left, LuminousFlux right) + { + return new LuminousFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LuminousFlux operator *(double left, LuminousFlux right) + { + return new LuminousFlux(left * right.Value, right.Unit); + } + + public static LuminousFlux operator *(LuminousFlux left, double right) + { + return new LuminousFlux(left.Value * right, left.Unit); + } + + public static LuminousFlux operator /(LuminousFlux left, double right) + { + return new LuminousFlux(left.Value / right, left.Unit); + } + + public static double operator /(LuminousFlux left, LuminousFlux right) + { + return left.Lumens / right.Lumens; + } + + #endregion + + public static bool operator <=(LuminousFlux left, LuminousFlux right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(LuminousFlux left, LuminousFlux right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(LuminousFlux left, LuminousFlux right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(LuminousFlux left, LuminousFlux right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(LuminousFlux left, LuminousFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(LuminousFlux left, LuminousFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousIntensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousIntensity.NetFramework.g.cs index 9a3cd7e620..87feb3a3eb 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousIntensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/LuminousIntensity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct LuminousIntensity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable LuminousIntensity from nullable Candela. + /// + public static LuminousIntensity? FromCandela(QuantityValue? candela) + { + return candela.HasValue ? FromCandela(candela.Value) : default(LuminousIntensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// LuminousIntensity unit value. + public static LuminousIntensity? From(QuantityValue? value, LuminousIntensityUnit fromUnit) + { + return value.HasValue ? new LuminousIntensity((double)value.Value, fromUnit) : default(LuminousIntensity?); + } + + #endregion + + #region Arithmetic Operators + + public static LuminousIntensity operator -(LuminousIntensity right) + { + return new LuminousIntensity(-right.Value, right.Unit); + } + + public static LuminousIntensity operator +(LuminousIntensity left, LuminousIntensity right) + { + return new LuminousIntensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LuminousIntensity operator -(LuminousIntensity left, LuminousIntensity right) + { + return new LuminousIntensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static LuminousIntensity operator *(double left, LuminousIntensity right) + { + return new LuminousIntensity(left * right.Value, right.Unit); + } + + public static LuminousIntensity operator *(LuminousIntensity left, double right) + { + return new LuminousIntensity(left.Value * right, left.Unit); + } + + public static LuminousIntensity operator /(LuminousIntensity left, double right) + { + return new LuminousIntensity(left.Value / right, left.Unit); + } + + public static double operator /(LuminousIntensity left, LuminousIntensity right) + { + return left.Candela / right.Candela; + } + + #endregion + + public static bool operator <=(LuminousIntensity left, LuminousIntensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(LuminousIntensity left, LuminousIntensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(LuminousIntensity left, LuminousIntensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(LuminousIntensity left, LuminousIntensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(LuminousIntensity left, LuminousIntensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(LuminousIntensity left, LuminousIntensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticField.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticField.NetFramework.g.cs index 18da5cca97..c91bdf9a2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticField.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticField.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct MagneticField : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MagneticField from nullable Teslas. + /// + public static MagneticField? FromTeslas(QuantityValue? teslas) + { + return teslas.HasValue ? FromTeslas(teslas.Value) : default(MagneticField?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MagneticField unit value. + public static MagneticField? From(QuantityValue? value, MagneticFieldUnit fromUnit) + { + return value.HasValue ? new MagneticField((double)value.Value, fromUnit) : default(MagneticField?); + } + + #endregion + + #region Arithmetic Operators + + public static MagneticField operator -(MagneticField right) + { + return new MagneticField(-right.Value, right.Unit); + } + + public static MagneticField operator +(MagneticField left, MagneticField right) + { + return new MagneticField(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MagneticField operator -(MagneticField left, MagneticField right) + { + return new MagneticField(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MagneticField operator *(double left, MagneticField right) + { + return new MagneticField(left * right.Value, right.Unit); + } + + public static MagneticField operator *(MagneticField left, double right) + { + return new MagneticField(left.Value * right, left.Unit); + } + + public static MagneticField operator /(MagneticField left, double right) + { + return new MagneticField(left.Value / right, left.Unit); + } + + public static double operator /(MagneticField left, MagneticField right) + { + return left.Teslas / right.Teslas; + } + + #endregion + + public static bool operator <=(MagneticField left, MagneticField right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MagneticField left, MagneticField right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MagneticField left, MagneticField right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MagneticField left, MagneticField right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MagneticField left, MagneticField right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MagneticField left, MagneticField right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticFlux.NetFramework.g.cs index a1ac370e37..c1e328b3ca 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MagneticFlux.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct MagneticFlux : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MagneticFlux from nullable Webers. + /// + public static MagneticFlux? FromWebers(QuantityValue? webers) + { + return webers.HasValue ? FromWebers(webers.Value) : default(MagneticFlux?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MagneticFlux unit value. + public static MagneticFlux? From(QuantityValue? value, MagneticFluxUnit fromUnit) + { + return value.HasValue ? new MagneticFlux((double)value.Value, fromUnit) : default(MagneticFlux?); + } + + #endregion + + #region Arithmetic Operators + + public static MagneticFlux operator -(MagneticFlux right) + { + return new MagneticFlux(-right.Value, right.Unit); + } + + public static MagneticFlux operator +(MagneticFlux left, MagneticFlux right) + { + return new MagneticFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MagneticFlux operator -(MagneticFlux left, MagneticFlux right) + { + return new MagneticFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MagneticFlux operator *(double left, MagneticFlux right) + { + return new MagneticFlux(left * right.Value, right.Unit); + } + + public static MagneticFlux operator *(MagneticFlux left, double right) + { + return new MagneticFlux(left.Value * right, left.Unit); + } + + public static MagneticFlux operator /(MagneticFlux left, double right) + { + return new MagneticFlux(left.Value / right, left.Unit); + } + + public static double operator /(MagneticFlux left, MagneticFlux right) + { + return left.Webers / right.Webers; + } + + #endregion + + public static bool operator <=(MagneticFlux left, MagneticFlux right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MagneticFlux left, MagneticFlux right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MagneticFlux left, MagneticFlux right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MagneticFlux left, MagneticFlux right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MagneticFlux left, MagneticFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MagneticFlux left, MagneticFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Magnetization.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Magnetization.NetFramework.g.cs index bd9f5aaaee..152d142f19 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Magnetization.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Magnetization.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct Magnetization : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Magnetization from nullable AmperesPerMeter. + /// + public static Magnetization? FromAmperesPerMeter(QuantityValue? amperespermeter) + { + return amperespermeter.HasValue ? FromAmperesPerMeter(amperespermeter.Value) : default(Magnetization?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Magnetization unit value. + public static Magnetization? From(QuantityValue? value, MagnetizationUnit fromUnit) + { + return value.HasValue ? new Magnetization((double)value.Value, fromUnit) : default(Magnetization?); + } + + #endregion + + #region Arithmetic Operators + + public static Magnetization operator -(Magnetization right) + { + return new Magnetization(-right.Value, right.Unit); + } + + public static Magnetization operator +(Magnetization left, Magnetization right) + { + return new Magnetization(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Magnetization operator -(Magnetization left, Magnetization right) + { + return new Magnetization(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Magnetization operator *(double left, Magnetization right) + { + return new Magnetization(left * right.Value, right.Unit); + } + + public static Magnetization operator *(Magnetization left, double right) + { + return new Magnetization(left.Value * right, left.Unit); + } + + public static Magnetization operator /(Magnetization left, double right) + { + return new Magnetization(left.Value / right, left.Unit); + } + + public static double operator /(Magnetization left, Magnetization right) + { + return left.AmperesPerMeter / right.AmperesPerMeter; + } + + #endregion + + public static bool operator <=(Magnetization left, Magnetization right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Magnetization left, Magnetization right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Magnetization left, Magnetization right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Magnetization left, Magnetization right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Magnetization left, Magnetization right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Magnetization left, Magnetization right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Mass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Mass.NetFramework.g.cs index 8185b8b7ae..cc56f41a6a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Mass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Mass.NetFramework.g.cs @@ -59,5 +59,261 @@ public partial struct Mass : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Mass from nullable Centigrams. + /// + public static Mass? FromCentigrams(QuantityValue? centigrams) + { + return centigrams.HasValue ? FromCentigrams(centigrams.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Decagrams. + /// + public static Mass? FromDecagrams(QuantityValue? decagrams) + { + return decagrams.HasValue ? FromDecagrams(decagrams.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Decigrams. + /// + public static Mass? FromDecigrams(QuantityValue? decigrams) + { + return decigrams.HasValue ? FromDecigrams(decigrams.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Grams. + /// + public static Mass? FromGrams(QuantityValue? grams) + { + return grams.HasValue ? FromGrams(grams.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Hectograms. + /// + public static Mass? FromHectograms(QuantityValue? hectograms) + { + return hectograms.HasValue ? FromHectograms(hectograms.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Kilograms. + /// + public static Mass? FromKilograms(QuantityValue? kilograms) + { + return kilograms.HasValue ? FromKilograms(kilograms.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Kilopounds. + /// + public static Mass? FromKilopounds(QuantityValue? kilopounds) + { + return kilopounds.HasValue ? FromKilopounds(kilopounds.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Kilotonnes. + /// + public static Mass? FromKilotonnes(QuantityValue? kilotonnes) + { + return kilotonnes.HasValue ? FromKilotonnes(kilotonnes.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable LongHundredweight. + /// + public static Mass? FromLongHundredweight(QuantityValue? longhundredweight) + { + return longhundredweight.HasValue ? FromLongHundredweight(longhundredweight.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable LongTons. + /// + public static Mass? FromLongTons(QuantityValue? longtons) + { + return longtons.HasValue ? FromLongTons(longtons.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Megapounds. + /// + public static Mass? FromMegapounds(QuantityValue? megapounds) + { + return megapounds.HasValue ? FromMegapounds(megapounds.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Megatonnes. + /// + public static Mass? FromMegatonnes(QuantityValue? megatonnes) + { + return megatonnes.HasValue ? FromMegatonnes(megatonnes.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Micrograms. + /// + public static Mass? FromMicrograms(QuantityValue? micrograms) + { + return micrograms.HasValue ? FromMicrograms(micrograms.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Milligrams. + /// + public static Mass? FromMilligrams(QuantityValue? milligrams) + { + return milligrams.HasValue ? FromMilligrams(milligrams.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Nanograms. + /// + public static Mass? FromNanograms(QuantityValue? nanograms) + { + return nanograms.HasValue ? FromNanograms(nanograms.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Ounces. + /// + public static Mass? FromOunces(QuantityValue? ounces) + { + return ounces.HasValue ? FromOunces(ounces.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Pounds. + /// + public static Mass? FromPounds(QuantityValue? pounds) + { + return pounds.HasValue ? FromPounds(pounds.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable ShortHundredweight. + /// + public static Mass? FromShortHundredweight(QuantityValue? shorthundredweight) + { + return shorthundredweight.HasValue ? FromShortHundredweight(shorthundredweight.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable ShortTons. + /// + public static Mass? FromShortTons(QuantityValue? shorttons) + { + return shorttons.HasValue ? FromShortTons(shorttons.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Stone. + /// + public static Mass? FromStone(QuantityValue? stone) + { + return stone.HasValue ? FromStone(stone.Value) : default(Mass?); + } + + /// + /// Get nullable Mass from nullable Tonnes. + /// + public static Mass? FromTonnes(QuantityValue? tonnes) + { + return tonnes.HasValue ? FromTonnes(tonnes.Value) : default(Mass?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Mass unit value. + public static Mass? From(QuantityValue? value, MassUnit fromUnit) + { + return value.HasValue ? new Mass((double)value.Value, fromUnit) : default(Mass?); + } + + #endregion + + #region Arithmetic Operators + + public static Mass operator -(Mass right) + { + return new Mass(-right.Value, right.Unit); + } + + public static Mass operator +(Mass left, Mass right) + { + return new Mass(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Mass operator -(Mass left, Mass right) + { + return new Mass(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Mass operator *(double left, Mass right) + { + return new Mass(left * right.Value, right.Unit); + } + + public static Mass operator *(Mass left, double right) + { + return new Mass(left.Value * right, left.Unit); + } + + public static Mass operator /(Mass left, double right) + { + return new Mass(left.Value / right, left.Unit); + } + + public static double operator /(Mass left, Mass right) + { + return left.Kilograms / right.Kilograms; + } + + #endregion + + public static bool operator <=(Mass left, Mass right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Mass left, Mass right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Mass left, Mass right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Mass left, Mass right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Mass left, Mass right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Mass left, Mass right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlow.NetFramework.g.cs index 46214b72c2..dca3268b4e 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlow.NetFramework.g.cs @@ -59,5 +59,213 @@ public partial struct MassFlow : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MassFlow from nullable CentigramsPerSecond. + /// + public static MassFlow? FromCentigramsPerSecond(QuantityValue? centigramspersecond) + { + return centigramspersecond.HasValue ? FromCentigramsPerSecond(centigramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable DecagramsPerSecond. + /// + public static MassFlow? FromDecagramsPerSecond(QuantityValue? decagramspersecond) + { + return decagramspersecond.HasValue ? FromDecagramsPerSecond(decagramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable DecigramsPerSecond. + /// + public static MassFlow? FromDecigramsPerSecond(QuantityValue? decigramspersecond) + { + return decigramspersecond.HasValue ? FromDecigramsPerSecond(decigramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable GramsPerSecond. + /// + public static MassFlow? FromGramsPerSecond(QuantityValue? gramspersecond) + { + return gramspersecond.HasValue ? FromGramsPerSecond(gramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable HectogramsPerSecond. + /// + public static MassFlow? FromHectogramsPerSecond(QuantityValue? hectogramspersecond) + { + return hectogramspersecond.HasValue ? FromHectogramsPerSecond(hectogramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable KilogramsPerHour. + /// + public static MassFlow? FromKilogramsPerHour(QuantityValue? kilogramsperhour) + { + return kilogramsperhour.HasValue ? FromKilogramsPerHour(kilogramsperhour.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable KilogramsPerSecond. + /// + public static MassFlow? FromKilogramsPerSecond(QuantityValue? kilogramspersecond) + { + return kilogramspersecond.HasValue ? FromKilogramsPerSecond(kilogramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable MegapoundsPerHour. + /// + public static MassFlow? FromMegapoundsPerHour(QuantityValue? megapoundsperhour) + { + return megapoundsperhour.HasValue ? FromMegapoundsPerHour(megapoundsperhour.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable MicrogramsPerSecond. + /// + public static MassFlow? FromMicrogramsPerSecond(QuantityValue? microgramspersecond) + { + return microgramspersecond.HasValue ? FromMicrogramsPerSecond(microgramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable MilligramsPerSecond. + /// + public static MassFlow? FromMilligramsPerSecond(QuantityValue? milligramspersecond) + { + return milligramspersecond.HasValue ? FromMilligramsPerSecond(milligramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable NanogramsPerSecond. + /// + public static MassFlow? FromNanogramsPerSecond(QuantityValue? nanogramspersecond) + { + return nanogramspersecond.HasValue ? FromNanogramsPerSecond(nanogramspersecond.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable PoundsPerHour. + /// + public static MassFlow? FromPoundsPerHour(QuantityValue? poundsperhour) + { + return poundsperhour.HasValue ? FromPoundsPerHour(poundsperhour.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable ShortTonsPerHour. + /// + public static MassFlow? FromShortTonsPerHour(QuantityValue? shorttonsperhour) + { + return shorttonsperhour.HasValue ? FromShortTonsPerHour(shorttonsperhour.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable TonnesPerDay. + /// + public static MassFlow? FromTonnesPerDay(QuantityValue? tonnesperday) + { + return tonnesperday.HasValue ? FromTonnesPerDay(tonnesperday.Value) : default(MassFlow?); + } + + /// + /// Get nullable MassFlow from nullable TonnesPerHour. + /// + public static MassFlow? FromTonnesPerHour(QuantityValue? tonnesperhour) + { + return tonnesperhour.HasValue ? FromTonnesPerHour(tonnesperhour.Value) : default(MassFlow?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassFlow unit value. + public static MassFlow? From(QuantityValue? value, MassFlowUnit fromUnit) + { + return value.HasValue ? new MassFlow((double)value.Value, fromUnit) : default(MassFlow?); + } + + #endregion + + #region Arithmetic Operators + + public static MassFlow operator -(MassFlow right) + { + return new MassFlow(-right.Value, right.Unit); + } + + public static MassFlow operator +(MassFlow left, MassFlow right) + { + return new MassFlow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassFlow operator -(MassFlow left, MassFlow right) + { + return new MassFlow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassFlow operator *(double left, MassFlow right) + { + return new MassFlow(left * right.Value, right.Unit); + } + + public static MassFlow operator *(MassFlow left, double right) + { + return new MassFlow(left.Value * right, left.Unit); + } + + public static MassFlow operator /(MassFlow left, double right) + { + return new MassFlow(left.Value / right, left.Unit); + } + + public static double operator /(MassFlow left, MassFlow right) + { + return left.GramsPerSecond / right.GramsPerSecond; + } + + #endregion + + public static bool operator <=(MassFlow left, MassFlow right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MassFlow left, MassFlow right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MassFlow left, MassFlow right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MassFlow left, MassFlow right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MassFlow left, MassFlow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MassFlow left, MassFlow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlux.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlux.NetFramework.g.cs index 312e53818c..0dc18a3fe1 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlux.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassFlux.NetFramework.g.cs @@ -59,5 +59,109 @@ public partial struct MassFlux : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MassFlux from nullable GramsPerSecondPerSquareMeter. + /// + public static MassFlux? FromGramsPerSecondPerSquareMeter(QuantityValue? gramspersecondpersquaremeter) + { + return gramspersecondpersquaremeter.HasValue ? FromGramsPerSecondPerSquareMeter(gramspersecondpersquaremeter.Value) : default(MassFlux?); + } + + /// + /// Get nullable MassFlux from nullable KilogramsPerSecondPerSquareMeter. + /// + public static MassFlux? FromKilogramsPerSecondPerSquareMeter(QuantityValue? kilogramspersecondpersquaremeter) + { + return kilogramspersecondpersquaremeter.HasValue ? FromKilogramsPerSecondPerSquareMeter(kilogramspersecondpersquaremeter.Value) : default(MassFlux?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassFlux unit value. + public static MassFlux? From(QuantityValue? value, MassFluxUnit fromUnit) + { + return value.HasValue ? new MassFlux((double)value.Value, fromUnit) : default(MassFlux?); + } + + #endregion + + #region Arithmetic Operators + + public static MassFlux operator -(MassFlux right) + { + return new MassFlux(-right.Value, right.Unit); + } + + public static MassFlux operator +(MassFlux left, MassFlux right) + { + return new MassFlux(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassFlux operator -(MassFlux left, MassFlux right) + { + return new MassFlux(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassFlux operator *(double left, MassFlux right) + { + return new MassFlux(left * right.Value, right.Unit); + } + + public static MassFlux operator *(MassFlux left, double right) + { + return new MassFlux(left.Value * right, left.Unit); + } + + public static MassFlux operator /(MassFlux left, double right) + { + return new MassFlux(left.Value / right, left.Unit); + } + + public static double operator /(MassFlux left, MassFlux right) + { + return left.KilogramsPerSecondPerSquareMeter / right.KilogramsPerSecondPerSquareMeter; + } + + #endregion + + public static bool operator <=(MassFlux left, MassFlux right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MassFlux left, MassFlux right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MassFlux left, MassFlux right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MassFlux left, MassFlux right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MassFlux left, MassFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MassFlux left, MassFlux right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassMomentOfInertia.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassMomentOfInertia.NetFramework.g.cs index 68d1e474ff..58261cca32 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MassMomentOfInertia.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MassMomentOfInertia.NetFramework.g.cs @@ -59,5 +59,301 @@ public partial struct MassMomentOfInertia : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MassMomentOfInertia from nullable GramSquareCentimeters. + /// + public static MassMomentOfInertia? FromGramSquareCentimeters(QuantityValue? gramsquarecentimeters) + { + return gramsquarecentimeters.HasValue ? FromGramSquareCentimeters(gramsquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable GramSquareDecimeters. + /// + public static MassMomentOfInertia? FromGramSquareDecimeters(QuantityValue? gramsquaredecimeters) + { + return gramsquaredecimeters.HasValue ? FromGramSquareDecimeters(gramsquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable GramSquareMeters. + /// + public static MassMomentOfInertia? FromGramSquareMeters(QuantityValue? gramsquaremeters) + { + return gramsquaremeters.HasValue ? FromGramSquareMeters(gramsquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable GramSquareMillimeters. + /// + public static MassMomentOfInertia? FromGramSquareMillimeters(QuantityValue? gramsquaremillimeters) + { + return gramsquaremillimeters.HasValue ? FromGramSquareMillimeters(gramsquaremillimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilogramSquareCentimeters. + /// + public static MassMomentOfInertia? FromKilogramSquareCentimeters(QuantityValue? kilogramsquarecentimeters) + { + return kilogramsquarecentimeters.HasValue ? FromKilogramSquareCentimeters(kilogramsquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilogramSquareDecimeters. + /// + public static MassMomentOfInertia? FromKilogramSquareDecimeters(QuantityValue? kilogramsquaredecimeters) + { + return kilogramsquaredecimeters.HasValue ? FromKilogramSquareDecimeters(kilogramsquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilogramSquareMeters. + /// + public static MassMomentOfInertia? FromKilogramSquareMeters(QuantityValue? kilogramsquaremeters) + { + return kilogramsquaremeters.HasValue ? FromKilogramSquareMeters(kilogramsquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilogramSquareMillimeters. + /// + public static MassMomentOfInertia? FromKilogramSquareMillimeters(QuantityValue? kilogramsquaremillimeters) + { + return kilogramsquaremillimeters.HasValue ? FromKilogramSquareMillimeters(kilogramsquaremillimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilotonneSquareCentimeters. + /// + public static MassMomentOfInertia? FromKilotonneSquareCentimeters(QuantityValue? kilotonnesquarecentimeters) + { + return kilotonnesquarecentimeters.HasValue ? FromKilotonneSquareCentimeters(kilotonnesquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilotonneSquareDecimeters. + /// + public static MassMomentOfInertia? FromKilotonneSquareDecimeters(QuantityValue? kilotonnesquaredecimeters) + { + return kilotonnesquaredecimeters.HasValue ? FromKilotonneSquareDecimeters(kilotonnesquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMeters. + /// + public static MassMomentOfInertia? FromKilotonneSquareMeters(QuantityValue? kilotonnesquaremeters) + { + return kilotonnesquaremeters.HasValue ? FromKilotonneSquareMeters(kilotonnesquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable KilotonneSquareMilimeters. + /// + public static MassMomentOfInertia? FromKilotonneSquareMilimeters(QuantityValue? kilotonnesquaremilimeters) + { + return kilotonnesquaremilimeters.HasValue ? FromKilotonneSquareMilimeters(kilotonnesquaremilimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MegatonneSquareCentimeters. + /// + public static MassMomentOfInertia? FromMegatonneSquareCentimeters(QuantityValue? megatonnesquarecentimeters) + { + return megatonnesquarecentimeters.HasValue ? FromMegatonneSquareCentimeters(megatonnesquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MegatonneSquareDecimeters. + /// + public static MassMomentOfInertia? FromMegatonneSquareDecimeters(QuantityValue? megatonnesquaredecimeters) + { + return megatonnesquaredecimeters.HasValue ? FromMegatonneSquareDecimeters(megatonnesquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMeters. + /// + public static MassMomentOfInertia? FromMegatonneSquareMeters(QuantityValue? megatonnesquaremeters) + { + return megatonnesquaremeters.HasValue ? FromMegatonneSquareMeters(megatonnesquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MegatonneSquareMilimeters. + /// + public static MassMomentOfInertia? FromMegatonneSquareMilimeters(QuantityValue? megatonnesquaremilimeters) + { + return megatonnesquaremilimeters.HasValue ? FromMegatonneSquareMilimeters(megatonnesquaremilimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MilligramSquareCentimeters. + /// + public static MassMomentOfInertia? FromMilligramSquareCentimeters(QuantityValue? milligramsquarecentimeters) + { + return milligramsquarecentimeters.HasValue ? FromMilligramSquareCentimeters(milligramsquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MilligramSquareDecimeters. + /// + public static MassMomentOfInertia? FromMilligramSquareDecimeters(QuantityValue? milligramsquaredecimeters) + { + return milligramsquaredecimeters.HasValue ? FromMilligramSquareDecimeters(milligramsquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MilligramSquareMeters. + /// + public static MassMomentOfInertia? FromMilligramSquareMeters(QuantityValue? milligramsquaremeters) + { + return milligramsquaremeters.HasValue ? FromMilligramSquareMeters(milligramsquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable MilligramSquareMillimeters. + /// + public static MassMomentOfInertia? FromMilligramSquareMillimeters(QuantityValue? milligramsquaremillimeters) + { + return milligramsquaremillimeters.HasValue ? FromMilligramSquareMillimeters(milligramsquaremillimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable PoundSquareFeet. + /// + public static MassMomentOfInertia? FromPoundSquareFeet(QuantityValue? poundsquarefeet) + { + return poundsquarefeet.HasValue ? FromPoundSquareFeet(poundsquarefeet.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable PoundSquareInches. + /// + public static MassMomentOfInertia? FromPoundSquareInches(QuantityValue? poundsquareinches) + { + return poundsquareinches.HasValue ? FromPoundSquareInches(poundsquareinches.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable TonneSquareCentimeters. + /// + public static MassMomentOfInertia? FromTonneSquareCentimeters(QuantityValue? tonnesquarecentimeters) + { + return tonnesquarecentimeters.HasValue ? FromTonneSquareCentimeters(tonnesquarecentimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable TonneSquareDecimeters. + /// + public static MassMomentOfInertia? FromTonneSquareDecimeters(QuantityValue? tonnesquaredecimeters) + { + return tonnesquaredecimeters.HasValue ? FromTonneSquareDecimeters(tonnesquaredecimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable TonneSquareMeters. + /// + public static MassMomentOfInertia? FromTonneSquareMeters(QuantityValue? tonnesquaremeters) + { + return tonnesquaremeters.HasValue ? FromTonneSquareMeters(tonnesquaremeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Get nullable MassMomentOfInertia from nullable TonneSquareMilimeters. + /// + public static MassMomentOfInertia? FromTonneSquareMilimeters(QuantityValue? tonnesquaremilimeters) + { + return tonnesquaremilimeters.HasValue ? FromTonneSquareMilimeters(tonnesquaremilimeters.Value) : default(MassMomentOfInertia?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MassMomentOfInertia unit value. + public static MassMomentOfInertia? From(QuantityValue? value, MassMomentOfInertiaUnit fromUnit) + { + return value.HasValue ? new MassMomentOfInertia((double)value.Value, fromUnit) : default(MassMomentOfInertia?); + } + + #endregion + + #region Arithmetic Operators + + public static MassMomentOfInertia operator -(MassMomentOfInertia right) + { + return new MassMomentOfInertia(-right.Value, right.Unit); + } + + public static MassMomentOfInertia operator +(MassMomentOfInertia left, MassMomentOfInertia right) + { + return new MassMomentOfInertia(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassMomentOfInertia operator -(MassMomentOfInertia left, MassMomentOfInertia right) + { + return new MassMomentOfInertia(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MassMomentOfInertia operator *(double left, MassMomentOfInertia right) + { + return new MassMomentOfInertia(left * right.Value, right.Unit); + } + + public static MassMomentOfInertia operator *(MassMomentOfInertia left, double right) + { + return new MassMomentOfInertia(left.Value * right, left.Unit); + } + + public static MassMomentOfInertia operator /(MassMomentOfInertia left, double right) + { + return new MassMomentOfInertia(left.Value / right, left.Unit); + } + + public static double operator /(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.KilogramSquareMeters / right.KilogramSquareMeters; + } + + #endregion + + public static bool operator <=(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MassMomentOfInertia left, MassMomentOfInertia right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MassMomentOfInertia left, MassMomentOfInertia right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MassMomentOfInertia left, MassMomentOfInertia right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEnergy.NetFramework.g.cs index 6a6af66cc1..ca22dec67d 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEnergy.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct MolarEnergy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MolarEnergy from nullable JoulesPerMole. + /// + public static MolarEnergy? FromJoulesPerMole(QuantityValue? joulespermole) + { + return joulespermole.HasValue ? FromJoulesPerMole(joulespermole.Value) : default(MolarEnergy?); + } + + /// + /// Get nullable MolarEnergy from nullable KilojoulesPerMole. + /// + public static MolarEnergy? FromKilojoulesPerMole(QuantityValue? kilojoulespermole) + { + return kilojoulespermole.HasValue ? FromKilojoulesPerMole(kilojoulespermole.Value) : default(MolarEnergy?); + } + + /// + /// Get nullable MolarEnergy from nullable MegajoulesPerMole. + /// + public static MolarEnergy? FromMegajoulesPerMole(QuantityValue? megajoulespermole) + { + return megajoulespermole.HasValue ? FromMegajoulesPerMole(megajoulespermole.Value) : default(MolarEnergy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarEnergy unit value. + public static MolarEnergy? From(QuantityValue? value, MolarEnergyUnit fromUnit) + { + return value.HasValue ? new MolarEnergy((double)value.Value, fromUnit) : default(MolarEnergy?); + } + + #endregion + + #region Arithmetic Operators + + public static MolarEnergy operator -(MolarEnergy right) + { + return new MolarEnergy(-right.Value, right.Unit); + } + + public static MolarEnergy operator +(MolarEnergy left, MolarEnergy right) + { + return new MolarEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarEnergy operator -(MolarEnergy left, MolarEnergy right) + { + return new MolarEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarEnergy operator *(double left, MolarEnergy right) + { + return new MolarEnergy(left * right.Value, right.Unit); + } + + public static MolarEnergy operator *(MolarEnergy left, double right) + { + return new MolarEnergy(left.Value * right, left.Unit); + } + + public static MolarEnergy operator /(MolarEnergy left, double right) + { + return new MolarEnergy(left.Value / right, left.Unit); + } + + public static double operator /(MolarEnergy left, MolarEnergy right) + { + return left.JoulesPerMole / right.JoulesPerMole; + } + + #endregion + + public static bool operator <=(MolarEnergy left, MolarEnergy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MolarEnergy left, MolarEnergy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MolarEnergy left, MolarEnergy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MolarEnergy left, MolarEnergy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MolarEnergy left, MolarEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MolarEnergy left, MolarEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEntropy.NetFramework.g.cs index 6cc2785532..daae941f2a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarEntropy.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct MolarEntropy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MolarEntropy from nullable JoulesPerMoleKelvin. + /// + public static MolarEntropy? FromJoulesPerMoleKelvin(QuantityValue? joulespermolekelvin) + { + return joulespermolekelvin.HasValue ? FromJoulesPerMoleKelvin(joulespermolekelvin.Value) : default(MolarEntropy?); + } + + /// + /// Get nullable MolarEntropy from nullable KilojoulesPerMoleKelvin. + /// + public static MolarEntropy? FromKilojoulesPerMoleKelvin(QuantityValue? kilojoulespermolekelvin) + { + return kilojoulespermolekelvin.HasValue ? FromKilojoulesPerMoleKelvin(kilojoulespermolekelvin.Value) : default(MolarEntropy?); + } + + /// + /// Get nullable MolarEntropy from nullable MegajoulesPerMoleKelvin. + /// + public static MolarEntropy? FromMegajoulesPerMoleKelvin(QuantityValue? megajoulespermolekelvin) + { + return megajoulespermolekelvin.HasValue ? FromMegajoulesPerMoleKelvin(megajoulespermolekelvin.Value) : default(MolarEntropy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarEntropy unit value. + public static MolarEntropy? From(QuantityValue? value, MolarEntropyUnit fromUnit) + { + return value.HasValue ? new MolarEntropy((double)value.Value, fromUnit) : default(MolarEntropy?); + } + + #endregion + + #region Arithmetic Operators + + public static MolarEntropy operator -(MolarEntropy right) + { + return new MolarEntropy(-right.Value, right.Unit); + } + + public static MolarEntropy operator +(MolarEntropy left, MolarEntropy right) + { + return new MolarEntropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarEntropy operator -(MolarEntropy left, MolarEntropy right) + { + return new MolarEntropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarEntropy operator *(double left, MolarEntropy right) + { + return new MolarEntropy(left * right.Value, right.Unit); + } + + public static MolarEntropy operator *(MolarEntropy left, double right) + { + return new MolarEntropy(left.Value * right, left.Unit); + } + + public static MolarEntropy operator /(MolarEntropy left, double right) + { + return new MolarEntropy(left.Value / right, left.Unit); + } + + public static double operator /(MolarEntropy left, MolarEntropy right) + { + return left.JoulesPerMoleKelvin / right.JoulesPerMoleKelvin; + } + + #endregion + + public static bool operator <=(MolarEntropy left, MolarEntropy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MolarEntropy left, MolarEntropy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MolarEntropy left, MolarEntropy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MolarEntropy left, MolarEntropy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MolarEntropy left, MolarEntropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MolarEntropy left, MolarEntropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarMass.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarMass.NetFramework.g.cs index 695795eef2..414b32baa0 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarMass.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/MolarMass.NetFramework.g.cs @@ -59,5 +59,189 @@ public partial struct MolarMass : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable MolarMass from nullable CentigramsPerMole. + /// + public static MolarMass? FromCentigramsPerMole(QuantityValue? centigramspermole) + { + return centigramspermole.HasValue ? FromCentigramsPerMole(centigramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable DecagramsPerMole. + /// + public static MolarMass? FromDecagramsPerMole(QuantityValue? decagramspermole) + { + return decagramspermole.HasValue ? FromDecagramsPerMole(decagramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable DecigramsPerMole. + /// + public static MolarMass? FromDecigramsPerMole(QuantityValue? decigramspermole) + { + return decigramspermole.HasValue ? FromDecigramsPerMole(decigramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable GramsPerMole. + /// + public static MolarMass? FromGramsPerMole(QuantityValue? gramspermole) + { + return gramspermole.HasValue ? FromGramsPerMole(gramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable HectogramsPerMole. + /// + public static MolarMass? FromHectogramsPerMole(QuantityValue? hectogramspermole) + { + return hectogramspermole.HasValue ? FromHectogramsPerMole(hectogramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable KilogramsPerMole. + /// + public static MolarMass? FromKilogramsPerMole(QuantityValue? kilogramspermole) + { + return kilogramspermole.HasValue ? FromKilogramsPerMole(kilogramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable KilopoundsPerMole. + /// + public static MolarMass? FromKilopoundsPerMole(QuantityValue? kilopoundspermole) + { + return kilopoundspermole.HasValue ? FromKilopoundsPerMole(kilopoundspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable MegapoundsPerMole. + /// + public static MolarMass? FromMegapoundsPerMole(QuantityValue? megapoundspermole) + { + return megapoundspermole.HasValue ? FromMegapoundsPerMole(megapoundspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable MicrogramsPerMole. + /// + public static MolarMass? FromMicrogramsPerMole(QuantityValue? microgramspermole) + { + return microgramspermole.HasValue ? FromMicrogramsPerMole(microgramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable MilligramsPerMole. + /// + public static MolarMass? FromMilligramsPerMole(QuantityValue? milligramspermole) + { + return milligramspermole.HasValue ? FromMilligramsPerMole(milligramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable NanogramsPerMole. + /// + public static MolarMass? FromNanogramsPerMole(QuantityValue? nanogramspermole) + { + return nanogramspermole.HasValue ? FromNanogramsPerMole(nanogramspermole.Value) : default(MolarMass?); + } + + /// + /// Get nullable MolarMass from nullable PoundsPerMole. + /// + public static MolarMass? FromPoundsPerMole(QuantityValue? poundspermole) + { + return poundspermole.HasValue ? FromPoundsPerMole(poundspermole.Value) : default(MolarMass?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// MolarMass unit value. + public static MolarMass? From(QuantityValue? value, MolarMassUnit fromUnit) + { + return value.HasValue ? new MolarMass((double)value.Value, fromUnit) : default(MolarMass?); + } + + #endregion + + #region Arithmetic Operators + + public static MolarMass operator -(MolarMass right) + { + return new MolarMass(-right.Value, right.Unit); + } + + public static MolarMass operator +(MolarMass left, MolarMass right) + { + return new MolarMass(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarMass operator -(MolarMass left, MolarMass right) + { + return new MolarMass(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static MolarMass operator *(double left, MolarMass right) + { + return new MolarMass(left * right.Value, right.Unit); + } + + public static MolarMass operator *(MolarMass left, double right) + { + return new MolarMass(left.Value * right, left.Unit); + } + + public static MolarMass operator /(MolarMass left, double right) + { + return new MolarMass(left.Value / right, left.Unit); + } + + public static double operator /(MolarMass left, MolarMass right) + { + return left.KilogramsPerMole / right.KilogramsPerMole; + } + + #endregion + + public static bool operator <=(MolarMass left, MolarMass right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(MolarMass left, MolarMass right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(MolarMass left, MolarMass right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(MolarMass left, MolarMass right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(MolarMass left, MolarMass right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(MolarMass left, MolarMass right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Molarity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Molarity.NetFramework.g.cs index 0763831aec..54ad2709bb 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Molarity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Molarity.NetFramework.g.cs @@ -59,5 +59,157 @@ public partial struct Molarity : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Molarity from nullable CentimolesPerLiter. + /// + public static Molarity? FromCentimolesPerLiter(QuantityValue? centimolesperliter) + { + return centimolesperliter.HasValue ? FromCentimolesPerLiter(centimolesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable DecimolesPerLiter. + /// + public static Molarity? FromDecimolesPerLiter(QuantityValue? decimolesperliter) + { + return decimolesperliter.HasValue ? FromDecimolesPerLiter(decimolesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable MicromolesPerLiter. + /// + public static Molarity? FromMicromolesPerLiter(QuantityValue? micromolesperliter) + { + return micromolesperliter.HasValue ? FromMicromolesPerLiter(micromolesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable MillimolesPerLiter. + /// + public static Molarity? FromMillimolesPerLiter(QuantityValue? millimolesperliter) + { + return millimolesperliter.HasValue ? FromMillimolesPerLiter(millimolesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable MolesPerCubicMeter. + /// + public static Molarity? FromMolesPerCubicMeter(QuantityValue? molespercubicmeter) + { + return molespercubicmeter.HasValue ? FromMolesPerCubicMeter(molespercubicmeter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable MolesPerLiter. + /// + public static Molarity? FromMolesPerLiter(QuantityValue? molesperliter) + { + return molesperliter.HasValue ? FromMolesPerLiter(molesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable NanomolesPerLiter. + /// + public static Molarity? FromNanomolesPerLiter(QuantityValue? nanomolesperliter) + { + return nanomolesperliter.HasValue ? FromNanomolesPerLiter(nanomolesperliter.Value) : default(Molarity?); + } + + /// + /// Get nullable Molarity from nullable PicomolesPerLiter. + /// + public static Molarity? FromPicomolesPerLiter(QuantityValue? picomolesperliter) + { + return picomolesperliter.HasValue ? FromPicomolesPerLiter(picomolesperliter.Value) : default(Molarity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Molarity unit value. + public static Molarity? From(QuantityValue? value, MolarityUnit fromUnit) + { + return value.HasValue ? new Molarity((double)value.Value, fromUnit) : default(Molarity?); + } + + #endregion + + #region Arithmetic Operators + + public static Molarity operator -(Molarity right) + { + return new Molarity(-right.Value, right.Unit); + } + + public static Molarity operator +(Molarity left, Molarity right) + { + return new Molarity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Molarity operator -(Molarity left, Molarity right) + { + return new Molarity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Molarity operator *(double left, Molarity right) + { + return new Molarity(left * right.Value, right.Unit); + } + + public static Molarity operator *(Molarity left, double right) + { + return new Molarity(left.Value * right, left.Unit); + } + + public static Molarity operator /(Molarity left, double right) + { + return new Molarity(left.Value / right, left.Unit); + } + + public static double operator /(Molarity left, Molarity right) + { + return left.MolesPerCubicMeter / right.MolesPerCubicMeter; + } + + #endregion + + public static bool operator <=(Molarity left, Molarity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Molarity left, Molarity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Molarity left, Molarity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Molarity left, Molarity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Molarity left, Molarity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Molarity left, Molarity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Permeability.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Permeability.NetFramework.g.cs index bb59ff0201..c14f023eb4 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Permeability.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Permeability.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct Permeability : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Permeability from nullable HenriesPerMeter. + /// + public static Permeability? FromHenriesPerMeter(QuantityValue? henriespermeter) + { + return henriespermeter.HasValue ? FromHenriesPerMeter(henriespermeter.Value) : default(Permeability?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Permeability unit value. + public static Permeability? From(QuantityValue? value, PermeabilityUnit fromUnit) + { + return value.HasValue ? new Permeability((double)value.Value, fromUnit) : default(Permeability?); + } + + #endregion + + #region Arithmetic Operators + + public static Permeability operator -(Permeability right) + { + return new Permeability(-right.Value, right.Unit); + } + + public static Permeability operator +(Permeability left, Permeability right) + { + return new Permeability(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Permeability operator -(Permeability left, Permeability right) + { + return new Permeability(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Permeability operator *(double left, Permeability right) + { + return new Permeability(left * right.Value, right.Unit); + } + + public static Permeability operator *(Permeability left, double right) + { + return new Permeability(left.Value * right, left.Unit); + } + + public static Permeability operator /(Permeability left, double right) + { + return new Permeability(left.Value / right, left.Unit); + } + + public static double operator /(Permeability left, Permeability right) + { + return left.HenriesPerMeter / right.HenriesPerMeter; + } + + #endregion + + public static bool operator <=(Permeability left, Permeability right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Permeability left, Permeability right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Permeability left, Permeability right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Permeability left, Permeability right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Permeability left, Permeability right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Permeability left, Permeability right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Permittivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Permittivity.NetFramework.g.cs index b75b1b2e03..edd0b3e4d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Permittivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Permittivity.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct Permittivity : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Permittivity from nullable FaradsPerMeter. + /// + public static Permittivity? FromFaradsPerMeter(QuantityValue? faradspermeter) + { + return faradspermeter.HasValue ? FromFaradsPerMeter(faradspermeter.Value) : default(Permittivity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Permittivity unit value. + public static Permittivity? From(QuantityValue? value, PermittivityUnit fromUnit) + { + return value.HasValue ? new Permittivity((double)value.Value, fromUnit) : default(Permittivity?); + } + + #endregion + + #region Arithmetic Operators + + public static Permittivity operator -(Permittivity right) + { + return new Permittivity(-right.Value, right.Unit); + } + + public static Permittivity operator +(Permittivity left, Permittivity right) + { + return new Permittivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Permittivity operator -(Permittivity left, Permittivity right) + { + return new Permittivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Permittivity operator *(double left, Permittivity right) + { + return new Permittivity(left * right.Value, right.Unit); + } + + public static Permittivity operator *(Permittivity left, double right) + { + return new Permittivity(left.Value * right, left.Unit); + } + + public static Permittivity operator /(Permittivity left, double right) + { + return new Permittivity(left.Value / right, left.Unit); + } + + public static double operator /(Permittivity left, Permittivity right) + { + return left.FaradsPerMeter / right.FaradsPerMeter; + } + + #endregion + + public static bool operator <=(Permittivity left, Permittivity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Permittivity left, Permittivity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Permittivity left, Permittivity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Permittivity left, Permittivity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Permittivity left, Permittivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Permittivity left, Permittivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Power.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Power.NetFramework.g.cs index 094e0e7fae..28c5278f23 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Power.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Power.NetFramework.g.cs @@ -59,5 +59,251 @@ public partial struct Power : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public decimal Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Power from nullable BoilerHorsepower. + /// + public static Power? FromBoilerHorsepower(QuantityValue? boilerhorsepower) + { + return boilerhorsepower.HasValue ? FromBoilerHorsepower(boilerhorsepower.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable BritishThermalUnitsPerHour. + /// + public static Power? FromBritishThermalUnitsPerHour(QuantityValue? britishthermalunitsperhour) + { + return britishthermalunitsperhour.HasValue ? FromBritishThermalUnitsPerHour(britishthermalunitsperhour.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Decawatts. + /// + public static Power? FromDecawatts(QuantityValue? decawatts) + { + return decawatts.HasValue ? FromDecawatts(decawatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Deciwatts. + /// + public static Power? FromDeciwatts(QuantityValue? deciwatts) + { + return deciwatts.HasValue ? FromDeciwatts(deciwatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable ElectricalHorsepower. + /// + public static Power? FromElectricalHorsepower(QuantityValue? electricalhorsepower) + { + return electricalhorsepower.HasValue ? FromElectricalHorsepower(electricalhorsepower.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Femtowatts. + /// + public static Power? FromFemtowatts(QuantityValue? femtowatts) + { + return femtowatts.HasValue ? FromFemtowatts(femtowatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Gigawatts. + /// + public static Power? FromGigawatts(QuantityValue? gigawatts) + { + return gigawatts.HasValue ? FromGigawatts(gigawatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable HydraulicHorsepower. + /// + public static Power? FromHydraulicHorsepower(QuantityValue? hydraulichorsepower) + { + return hydraulichorsepower.HasValue ? FromHydraulicHorsepower(hydraulichorsepower.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable KilobritishThermalUnitsPerHour. + /// + public static Power? FromKilobritishThermalUnitsPerHour(QuantityValue? kilobritishthermalunitsperhour) + { + return kilobritishthermalunitsperhour.HasValue ? FromKilobritishThermalUnitsPerHour(kilobritishthermalunitsperhour.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Kilowatts. + /// + public static Power? FromKilowatts(QuantityValue? kilowatts) + { + return kilowatts.HasValue ? FromKilowatts(kilowatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable MechanicalHorsepower. + /// + public static Power? FromMechanicalHorsepower(QuantityValue? mechanicalhorsepower) + { + return mechanicalhorsepower.HasValue ? FromMechanicalHorsepower(mechanicalhorsepower.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Megawatts. + /// + public static Power? FromMegawatts(QuantityValue? megawatts) + { + return megawatts.HasValue ? FromMegawatts(megawatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable MetricHorsepower. + /// + public static Power? FromMetricHorsepower(QuantityValue? metrichorsepower) + { + return metrichorsepower.HasValue ? FromMetricHorsepower(metrichorsepower.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Microwatts. + /// + public static Power? FromMicrowatts(QuantityValue? microwatts) + { + return microwatts.HasValue ? FromMicrowatts(microwatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Milliwatts. + /// + public static Power? FromMilliwatts(QuantityValue? milliwatts) + { + return milliwatts.HasValue ? FromMilliwatts(milliwatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Nanowatts. + /// + public static Power? FromNanowatts(QuantityValue? nanowatts) + { + return nanowatts.HasValue ? FromNanowatts(nanowatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Petawatts. + /// + public static Power? FromPetawatts(QuantityValue? petawatts) + { + return petawatts.HasValue ? FromPetawatts(petawatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Picowatts. + /// + public static Power? FromPicowatts(QuantityValue? picowatts) + { + return picowatts.HasValue ? FromPicowatts(picowatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Terawatts. + /// + public static Power? FromTerawatts(QuantityValue? terawatts) + { + return terawatts.HasValue ? FromTerawatts(terawatts.Value) : default(Power?); + } + + /// + /// Get nullable Power from nullable Watts. + /// + public static Power? FromWatts(QuantityValue? watts) + { + return watts.HasValue ? FromWatts(watts.Value) : default(Power?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Power unit value. + public static Power? From(QuantityValue? value, PowerUnit fromUnit) + { + return value.HasValue ? new Power((decimal)value.Value, fromUnit) : default(Power?); + } + + #endregion + + #region Arithmetic Operators + + public static Power operator -(Power right) + { + return new Power(-right.Value, right.Unit); + } + + public static Power operator +(Power left, Power right) + { + return new Power(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Power operator -(Power left, Power right) + { + return new Power(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Power operator *(decimal left, Power right) + { + return new Power(left * right.Value, right.Unit); + } + + public static Power operator *(Power left, decimal right) + { + return new Power(left.Value * right, left.Unit); + } + + public static Power operator /(Power left, decimal right) + { + return new Power(left.Value / right, left.Unit); + } + + public static double operator /(Power left, Power right) + { + return left.Watts / right.Watts; + } + + #endregion + + public static bool operator <=(Power left, Power right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Power left, Power right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Power left, Power right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Power left, Power right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + public static bool operator ==(Power left, Power right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + public static bool operator !=(Power left, Power right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerDensity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerDensity.NetFramework.g.cs index f4e128a9f4..1269717f7b 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerDensity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerDensity.NetFramework.g.cs @@ -59,5 +59,445 @@ public partial struct PowerDensity : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable PowerDensity from nullable DecawattsPerCubicFoot. + /// + public static PowerDensity? FromDecawattsPerCubicFoot(QuantityValue? decawattspercubicfoot) + { + return decawattspercubicfoot.HasValue ? FromDecawattsPerCubicFoot(decawattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DecawattsPerCubicInch. + /// + public static PowerDensity? FromDecawattsPerCubicInch(QuantityValue? decawattspercubicinch) + { + return decawattspercubicinch.HasValue ? FromDecawattsPerCubicInch(decawattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DecawattsPerCubicMeter. + /// + public static PowerDensity? FromDecawattsPerCubicMeter(QuantityValue? decawattspercubicmeter) + { + return decawattspercubicmeter.HasValue ? FromDecawattsPerCubicMeter(decawattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DecawattsPerLiter. + /// + public static PowerDensity? FromDecawattsPerLiter(QuantityValue? decawattsperliter) + { + return decawattsperliter.HasValue ? FromDecawattsPerLiter(decawattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DeciwattsPerCubicFoot. + /// + public static PowerDensity? FromDeciwattsPerCubicFoot(QuantityValue? deciwattspercubicfoot) + { + return deciwattspercubicfoot.HasValue ? FromDeciwattsPerCubicFoot(deciwattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DeciwattsPerCubicInch. + /// + public static PowerDensity? FromDeciwattsPerCubicInch(QuantityValue? deciwattspercubicinch) + { + return deciwattspercubicinch.HasValue ? FromDeciwattsPerCubicInch(deciwattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DeciwattsPerCubicMeter. + /// + public static PowerDensity? FromDeciwattsPerCubicMeter(QuantityValue? deciwattspercubicmeter) + { + return deciwattspercubicmeter.HasValue ? FromDeciwattsPerCubicMeter(deciwattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable DeciwattsPerLiter. + /// + public static PowerDensity? FromDeciwattsPerLiter(QuantityValue? deciwattsperliter) + { + return deciwattsperliter.HasValue ? FromDeciwattsPerLiter(deciwattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable GigawattsPerCubicFoot. + /// + public static PowerDensity? FromGigawattsPerCubicFoot(QuantityValue? gigawattspercubicfoot) + { + return gigawattspercubicfoot.HasValue ? FromGigawattsPerCubicFoot(gigawattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable GigawattsPerCubicInch. + /// + public static PowerDensity? FromGigawattsPerCubicInch(QuantityValue? gigawattspercubicinch) + { + return gigawattspercubicinch.HasValue ? FromGigawattsPerCubicInch(gigawattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable GigawattsPerCubicMeter. + /// + public static PowerDensity? FromGigawattsPerCubicMeter(QuantityValue? gigawattspercubicmeter) + { + return gigawattspercubicmeter.HasValue ? FromGigawattsPerCubicMeter(gigawattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable GigawattsPerLiter. + /// + public static PowerDensity? FromGigawattsPerLiter(QuantityValue? gigawattsperliter) + { + return gigawattsperliter.HasValue ? FromGigawattsPerLiter(gigawattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable KilowattsPerCubicFoot. + /// + public static PowerDensity? FromKilowattsPerCubicFoot(QuantityValue? kilowattspercubicfoot) + { + return kilowattspercubicfoot.HasValue ? FromKilowattsPerCubicFoot(kilowattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable KilowattsPerCubicInch. + /// + public static PowerDensity? FromKilowattsPerCubicInch(QuantityValue? kilowattspercubicinch) + { + return kilowattspercubicinch.HasValue ? FromKilowattsPerCubicInch(kilowattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable KilowattsPerCubicMeter. + /// + public static PowerDensity? FromKilowattsPerCubicMeter(QuantityValue? kilowattspercubicmeter) + { + return kilowattspercubicmeter.HasValue ? FromKilowattsPerCubicMeter(kilowattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable KilowattsPerLiter. + /// + public static PowerDensity? FromKilowattsPerLiter(QuantityValue? kilowattsperliter) + { + return kilowattsperliter.HasValue ? FromKilowattsPerLiter(kilowattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MegawattsPerCubicFoot. + /// + public static PowerDensity? FromMegawattsPerCubicFoot(QuantityValue? megawattspercubicfoot) + { + return megawattspercubicfoot.HasValue ? FromMegawattsPerCubicFoot(megawattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MegawattsPerCubicInch. + /// + public static PowerDensity? FromMegawattsPerCubicInch(QuantityValue? megawattspercubicinch) + { + return megawattspercubicinch.HasValue ? FromMegawattsPerCubicInch(megawattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MegawattsPerCubicMeter. + /// + public static PowerDensity? FromMegawattsPerCubicMeter(QuantityValue? megawattspercubicmeter) + { + return megawattspercubicmeter.HasValue ? FromMegawattsPerCubicMeter(megawattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MegawattsPerLiter. + /// + public static PowerDensity? FromMegawattsPerLiter(QuantityValue? megawattsperliter) + { + return megawattsperliter.HasValue ? FromMegawattsPerLiter(megawattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MicrowattsPerCubicFoot. + /// + public static PowerDensity? FromMicrowattsPerCubicFoot(QuantityValue? microwattspercubicfoot) + { + return microwattspercubicfoot.HasValue ? FromMicrowattsPerCubicFoot(microwattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MicrowattsPerCubicInch. + /// + public static PowerDensity? FromMicrowattsPerCubicInch(QuantityValue? microwattspercubicinch) + { + return microwattspercubicinch.HasValue ? FromMicrowattsPerCubicInch(microwattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MicrowattsPerCubicMeter. + /// + public static PowerDensity? FromMicrowattsPerCubicMeter(QuantityValue? microwattspercubicmeter) + { + return microwattspercubicmeter.HasValue ? FromMicrowattsPerCubicMeter(microwattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MicrowattsPerLiter. + /// + public static PowerDensity? FromMicrowattsPerLiter(QuantityValue? microwattsperliter) + { + return microwattsperliter.HasValue ? FromMicrowattsPerLiter(microwattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MilliwattsPerCubicFoot. + /// + public static PowerDensity? FromMilliwattsPerCubicFoot(QuantityValue? milliwattspercubicfoot) + { + return milliwattspercubicfoot.HasValue ? FromMilliwattsPerCubicFoot(milliwattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MilliwattsPerCubicInch. + /// + public static PowerDensity? FromMilliwattsPerCubicInch(QuantityValue? milliwattspercubicinch) + { + return milliwattspercubicinch.HasValue ? FromMilliwattsPerCubicInch(milliwattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MilliwattsPerCubicMeter. + /// + public static PowerDensity? FromMilliwattsPerCubicMeter(QuantityValue? milliwattspercubicmeter) + { + return milliwattspercubicmeter.HasValue ? FromMilliwattsPerCubicMeter(milliwattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable MilliwattsPerLiter. + /// + public static PowerDensity? FromMilliwattsPerLiter(QuantityValue? milliwattsperliter) + { + return milliwattsperliter.HasValue ? FromMilliwattsPerLiter(milliwattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable NanowattsPerCubicFoot. + /// + public static PowerDensity? FromNanowattsPerCubicFoot(QuantityValue? nanowattspercubicfoot) + { + return nanowattspercubicfoot.HasValue ? FromNanowattsPerCubicFoot(nanowattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable NanowattsPerCubicInch. + /// + public static PowerDensity? FromNanowattsPerCubicInch(QuantityValue? nanowattspercubicinch) + { + return nanowattspercubicinch.HasValue ? FromNanowattsPerCubicInch(nanowattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable NanowattsPerCubicMeter. + /// + public static PowerDensity? FromNanowattsPerCubicMeter(QuantityValue? nanowattspercubicmeter) + { + return nanowattspercubicmeter.HasValue ? FromNanowattsPerCubicMeter(nanowattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable NanowattsPerLiter. + /// + public static PowerDensity? FromNanowattsPerLiter(QuantityValue? nanowattsperliter) + { + return nanowattsperliter.HasValue ? FromNanowattsPerLiter(nanowattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable PicowattsPerCubicFoot. + /// + public static PowerDensity? FromPicowattsPerCubicFoot(QuantityValue? picowattspercubicfoot) + { + return picowattspercubicfoot.HasValue ? FromPicowattsPerCubicFoot(picowattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable PicowattsPerCubicInch. + /// + public static PowerDensity? FromPicowattsPerCubicInch(QuantityValue? picowattspercubicinch) + { + return picowattspercubicinch.HasValue ? FromPicowattsPerCubicInch(picowattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable PicowattsPerCubicMeter. + /// + public static PowerDensity? FromPicowattsPerCubicMeter(QuantityValue? picowattspercubicmeter) + { + return picowattspercubicmeter.HasValue ? FromPicowattsPerCubicMeter(picowattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable PicowattsPerLiter. + /// + public static PowerDensity? FromPicowattsPerLiter(QuantityValue? picowattsperliter) + { + return picowattsperliter.HasValue ? FromPicowattsPerLiter(picowattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable TerawattsPerCubicFoot. + /// + public static PowerDensity? FromTerawattsPerCubicFoot(QuantityValue? terawattspercubicfoot) + { + return terawattspercubicfoot.HasValue ? FromTerawattsPerCubicFoot(terawattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable TerawattsPerCubicInch. + /// + public static PowerDensity? FromTerawattsPerCubicInch(QuantityValue? terawattspercubicinch) + { + return terawattspercubicinch.HasValue ? FromTerawattsPerCubicInch(terawattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable TerawattsPerCubicMeter. + /// + public static PowerDensity? FromTerawattsPerCubicMeter(QuantityValue? terawattspercubicmeter) + { + return terawattspercubicmeter.HasValue ? FromTerawattsPerCubicMeter(terawattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable TerawattsPerLiter. + /// + public static PowerDensity? FromTerawattsPerLiter(QuantityValue? terawattsperliter) + { + return terawattsperliter.HasValue ? FromTerawattsPerLiter(terawattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable WattsPerCubicFoot. + /// + public static PowerDensity? FromWattsPerCubicFoot(QuantityValue? wattspercubicfoot) + { + return wattspercubicfoot.HasValue ? FromWattsPerCubicFoot(wattspercubicfoot.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable WattsPerCubicInch. + /// + public static PowerDensity? FromWattsPerCubicInch(QuantityValue? wattspercubicinch) + { + return wattspercubicinch.HasValue ? FromWattsPerCubicInch(wattspercubicinch.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable WattsPerCubicMeter. + /// + public static PowerDensity? FromWattsPerCubicMeter(QuantityValue? wattspercubicmeter) + { + return wattspercubicmeter.HasValue ? FromWattsPerCubicMeter(wattspercubicmeter.Value) : default(PowerDensity?); + } + + /// + /// Get nullable PowerDensity from nullable WattsPerLiter. + /// + public static PowerDensity? FromWattsPerLiter(QuantityValue? wattsperliter) + { + return wattsperliter.HasValue ? FromWattsPerLiter(wattsperliter.Value) : default(PowerDensity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PowerDensity unit value. + public static PowerDensity? From(QuantityValue? value, PowerDensityUnit fromUnit) + { + return value.HasValue ? new PowerDensity((double)value.Value, fromUnit) : default(PowerDensity?); + } + + #endregion + + #region Arithmetic Operators + + public static PowerDensity operator -(PowerDensity right) + { + return new PowerDensity(-right.Value, right.Unit); + } + + public static PowerDensity operator +(PowerDensity left, PowerDensity right) + { + return new PowerDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static PowerDensity operator -(PowerDensity left, PowerDensity right) + { + return new PowerDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static PowerDensity operator *(double left, PowerDensity right) + { + return new PowerDensity(left * right.Value, right.Unit); + } + + public static PowerDensity operator *(PowerDensity left, double right) + { + return new PowerDensity(left.Value * right, left.Unit); + } + + public static PowerDensity operator /(PowerDensity left, double right) + { + return new PowerDensity(left.Value / right, left.Unit); + } + + public static double operator /(PowerDensity left, PowerDensity right) + { + return left.WattsPerCubicMeter / right.WattsPerCubicMeter; + } + + #endregion + + public static bool operator <=(PowerDensity left, PowerDensity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(PowerDensity left, PowerDensity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(PowerDensity left, PowerDensity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(PowerDensity left, PowerDensity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(PowerDensity left, PowerDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(PowerDensity left, PowerDensity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerRatio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerRatio.NetFramework.g.cs index ac5163105a..e9e0356af2 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerRatio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/PowerRatio.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct PowerRatio : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable PowerRatio from nullable DecibelMilliwatts. + /// + public static PowerRatio? FromDecibelMilliwatts(QuantityValue? decibelmilliwatts) + { + return decibelmilliwatts.HasValue ? FromDecibelMilliwatts(decibelmilliwatts.Value) : default(PowerRatio?); + } + + /// + /// Get nullable PowerRatio from nullable DecibelWatts. + /// + public static PowerRatio? FromDecibelWatts(QuantityValue? decibelwatts) + { + return decibelwatts.HasValue ? FromDecibelWatts(decibelwatts.Value) : default(PowerRatio?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PowerRatio unit value. + public static PowerRatio? From(QuantityValue? value, PowerRatioUnit fromUnit) + { + return value.HasValue ? new PowerRatio((double)value.Value, fromUnit) : default(PowerRatio?); + } + + #endregion + + #region Logarithmic Arithmetic Operators + + public static PowerRatio operator -(PowerRatio right) + { + return new PowerRatio(-right.Value, right.Unit); + } + + public static PowerRatio operator +(PowerRatio left, PowerRatio right) + { + // Logarithmic addition + // Formula: 10*log10(10^(x/10) + 10^(y/10)) + return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); + } + + public static PowerRatio operator -(PowerRatio left, PowerRatio right) + { + // Logarithmic subtraction + // Formula: 10*log10(10^(x/10) - 10^(y/10)) + return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); + } + + public static PowerRatio operator *(double left, PowerRatio right) + { + // Logarithmic multiplication = addition + return new PowerRatio(left + right.Value, right.Unit); + } + + public static PowerRatio operator *(PowerRatio left, double right) + { + // Logarithmic multiplication = addition + return new PowerRatio(left.Value + (double)right, left.Unit); + } + + public static PowerRatio operator /(PowerRatio left, double right) + { + // Logarithmic division = subtraction + return new PowerRatio(left.Value - (double)right, left.Unit); + } + + public static double operator /(PowerRatio left, PowerRatio right) + { + // Logarithmic division = subtraction + return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); + } + + #endregion + + public static bool operator <=(PowerRatio left, PowerRatio right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(PowerRatio left, PowerRatio right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(PowerRatio left, PowerRatio right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(PowerRatio left, PowerRatio right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(PowerRatio left, PowerRatio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(PowerRatio left, PowerRatio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Pressure.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Pressure.NetFramework.g.cs index 152f582b39..dc6d8205ef 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Pressure.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Pressure.NetFramework.g.cs @@ -59,5 +59,397 @@ public partial struct Pressure : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Pressure from nullable Atmospheres. + /// + public static Pressure? FromAtmospheres(QuantityValue? atmospheres) + { + return atmospheres.HasValue ? FromAtmospheres(atmospheres.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Bars. + /// + public static Pressure? FromBars(QuantityValue? bars) + { + return bars.HasValue ? FromBars(bars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Centibars. + /// + public static Pressure? FromCentibars(QuantityValue? centibars) + { + return centibars.HasValue ? FromCentibars(centibars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Decapascals. + /// + public static Pressure? FromDecapascals(QuantityValue? decapascals) + { + return decapascals.HasValue ? FromDecapascals(decapascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Decibars. + /// + public static Pressure? FromDecibars(QuantityValue? decibars) + { + return decibars.HasValue ? FromDecibars(decibars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable FeetOfHead. + /// + public static Pressure? FromFeetOfHead(QuantityValue? feetofhead) + { + return feetofhead.HasValue ? FromFeetOfHead(feetofhead.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Gigapascals. + /// + public static Pressure? FromGigapascals(QuantityValue? gigapascals) + { + return gigapascals.HasValue ? FromGigapascals(gigapascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Hectopascals. + /// + public static Pressure? FromHectopascals(QuantityValue? hectopascals) + { + return hectopascals.HasValue ? FromHectopascals(hectopascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable InchesOfMercury. + /// + public static Pressure? FromInchesOfMercury(QuantityValue? inchesofmercury) + { + return inchesofmercury.HasValue ? FromInchesOfMercury(inchesofmercury.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Kilobars. + /// + public static Pressure? FromKilobars(QuantityValue? kilobars) + { + return kilobars.HasValue ? FromKilobars(kilobars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilogramsForcePerSquareCentimeter. + /// + public static Pressure? FromKilogramsForcePerSquareCentimeter(QuantityValue? kilogramsforcepersquarecentimeter) + { + return kilogramsforcepersquarecentimeter.HasValue ? FromKilogramsForcePerSquareCentimeter(kilogramsforcepersquarecentimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilogramsForcePerSquareMeter. + /// + public static Pressure? FromKilogramsForcePerSquareMeter(QuantityValue? kilogramsforcepersquaremeter) + { + return kilogramsforcepersquaremeter.HasValue ? FromKilogramsForcePerSquareMeter(kilogramsforcepersquaremeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilogramsForcePerSquareMillimeter. + /// + public static Pressure? FromKilogramsForcePerSquareMillimeter(QuantityValue? kilogramsforcepersquaremillimeter) + { + return kilogramsforcepersquaremillimeter.HasValue ? FromKilogramsForcePerSquareMillimeter(kilogramsforcepersquaremillimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilonewtonsPerSquareCentimeter. + /// + public static Pressure? FromKilonewtonsPerSquareCentimeter(QuantityValue? kilonewtonspersquarecentimeter) + { + return kilonewtonspersquarecentimeter.HasValue ? FromKilonewtonsPerSquareCentimeter(kilonewtonspersquarecentimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilonewtonsPerSquareMeter. + /// + public static Pressure? FromKilonewtonsPerSquareMeter(QuantityValue? kilonewtonspersquaremeter) + { + return kilonewtonspersquaremeter.HasValue ? FromKilonewtonsPerSquareMeter(kilonewtonspersquaremeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilonewtonsPerSquareMillimeter. + /// + public static Pressure? FromKilonewtonsPerSquareMillimeter(QuantityValue? kilonewtonspersquaremillimeter) + { + return kilonewtonspersquaremillimeter.HasValue ? FromKilonewtonsPerSquareMillimeter(kilonewtonspersquaremillimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Kilopascals. + /// + public static Pressure? FromKilopascals(QuantityValue? kilopascals) + { + return kilopascals.HasValue ? FromKilopascals(kilopascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilopoundsForcePerSquareFoot. + /// + public static Pressure? FromKilopoundsForcePerSquareFoot(QuantityValue? kilopoundsforcepersquarefoot) + { + return kilopoundsforcepersquarefoot.HasValue ? FromKilopoundsForcePerSquareFoot(kilopoundsforcepersquarefoot.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable KilopoundsForcePerSquareInch. + /// + public static Pressure? FromKilopoundsForcePerSquareInch(QuantityValue? kilopoundsforcepersquareinch) + { + return kilopoundsforcepersquareinch.HasValue ? FromKilopoundsForcePerSquareInch(kilopoundsforcepersquareinch.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Megabars. + /// + public static Pressure? FromMegabars(QuantityValue? megabars) + { + return megabars.HasValue ? FromMegabars(megabars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable MeganewtonsPerSquareMeter. + /// + public static Pressure? FromMeganewtonsPerSquareMeter(QuantityValue? meganewtonspersquaremeter) + { + return meganewtonspersquaremeter.HasValue ? FromMeganewtonsPerSquareMeter(meganewtonspersquaremeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Megapascals. + /// + public static Pressure? FromMegapascals(QuantityValue? megapascals) + { + return megapascals.HasValue ? FromMegapascals(megapascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable MetersOfHead. + /// + public static Pressure? FromMetersOfHead(QuantityValue? metersofhead) + { + return metersofhead.HasValue ? FromMetersOfHead(metersofhead.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Micropascals. + /// + public static Pressure? FromMicropascals(QuantityValue? micropascals) + { + return micropascals.HasValue ? FromMicropascals(micropascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Millibars. + /// + public static Pressure? FromMillibars(QuantityValue? millibars) + { + return millibars.HasValue ? FromMillibars(millibars.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable MillimetersOfMercury. + /// + public static Pressure? FromMillimetersOfMercury(QuantityValue? millimetersofmercury) + { + return millimetersofmercury.HasValue ? FromMillimetersOfMercury(millimetersofmercury.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable NewtonsPerSquareCentimeter. + /// + public static Pressure? FromNewtonsPerSquareCentimeter(QuantityValue? newtonspersquarecentimeter) + { + return newtonspersquarecentimeter.HasValue ? FromNewtonsPerSquareCentimeter(newtonspersquarecentimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable NewtonsPerSquareMeter. + /// + public static Pressure? FromNewtonsPerSquareMeter(QuantityValue? newtonspersquaremeter) + { + return newtonspersquaremeter.HasValue ? FromNewtonsPerSquareMeter(newtonspersquaremeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable NewtonsPerSquareMillimeter. + /// + public static Pressure? FromNewtonsPerSquareMillimeter(QuantityValue? newtonspersquaremillimeter) + { + return newtonspersquaremillimeter.HasValue ? FromNewtonsPerSquareMillimeter(newtonspersquaremillimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Pascals. + /// + public static Pressure? FromPascals(QuantityValue? pascals) + { + return pascals.HasValue ? FromPascals(pascals.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable PoundsForcePerSquareFoot. + /// + public static Pressure? FromPoundsForcePerSquareFoot(QuantityValue? poundsforcepersquarefoot) + { + return poundsforcepersquarefoot.HasValue ? FromPoundsForcePerSquareFoot(poundsforcepersquarefoot.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable PoundsForcePerSquareInch. + /// + public static Pressure? FromPoundsForcePerSquareInch(QuantityValue? poundsforcepersquareinch) + { + return poundsforcepersquareinch.HasValue ? FromPoundsForcePerSquareInch(poundsforcepersquareinch.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Psi. + /// + public static Pressure? FromPsi(QuantityValue? psi) + { + return psi.HasValue ? FromPsi(psi.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable TechnicalAtmospheres. + /// + public static Pressure? FromTechnicalAtmospheres(QuantityValue? technicalatmospheres) + { + return technicalatmospheres.HasValue ? FromTechnicalAtmospheres(technicalatmospheres.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable TonnesForcePerSquareCentimeter. + /// + public static Pressure? FromTonnesForcePerSquareCentimeter(QuantityValue? tonnesforcepersquarecentimeter) + { + return tonnesforcepersquarecentimeter.HasValue ? FromTonnesForcePerSquareCentimeter(tonnesforcepersquarecentimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable TonnesForcePerSquareMeter. + /// + public static Pressure? FromTonnesForcePerSquareMeter(QuantityValue? tonnesforcepersquaremeter) + { + return tonnesforcepersquaremeter.HasValue ? FromTonnesForcePerSquareMeter(tonnesforcepersquaremeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable TonnesForcePerSquareMillimeter. + /// + public static Pressure? FromTonnesForcePerSquareMillimeter(QuantityValue? tonnesforcepersquaremillimeter) + { + return tonnesforcepersquaremillimeter.HasValue ? FromTonnesForcePerSquareMillimeter(tonnesforcepersquaremillimeter.Value) : default(Pressure?); + } + + /// + /// Get nullable Pressure from nullable Torrs. + /// + public static Pressure? FromTorrs(QuantityValue? torrs) + { + return torrs.HasValue ? FromTorrs(torrs.Value) : default(Pressure?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Pressure unit value. + public static Pressure? From(QuantityValue? value, PressureUnit fromUnit) + { + return value.HasValue ? new Pressure((double)value.Value, fromUnit) : default(Pressure?); + } + + #endregion + + #region Arithmetic Operators + + public static Pressure operator -(Pressure right) + { + return new Pressure(-right.Value, right.Unit); + } + + public static Pressure operator +(Pressure left, Pressure right) + { + return new Pressure(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Pressure operator -(Pressure left, Pressure right) + { + return new Pressure(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Pressure operator *(double left, Pressure right) + { + return new Pressure(left * right.Value, right.Unit); + } + + public static Pressure operator *(Pressure left, double right) + { + return new Pressure(left.Value * right, left.Unit); + } + + public static Pressure operator /(Pressure left, double right) + { + return new Pressure(left.Value / right, left.Unit); + } + + public static double operator /(Pressure left, Pressure right) + { + return left.Pascals / right.Pascals; + } + + #endregion + + public static bool operator <=(Pressure left, Pressure right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Pressure left, Pressure right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Pressure left, Pressure right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Pressure left, Pressure right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Pressure left, Pressure right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Pressure left, Pressure right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/PressureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/PressureChangeRate.NetFramework.g.cs index ef689558be..88b0fd5995 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/PressureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/PressureChangeRate.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct PressureChangeRate : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable PressureChangeRate from nullable AtmospheresPerSecond. + /// + public static PressureChangeRate? FromAtmospheresPerSecond(QuantityValue? atmospherespersecond) + { + return atmospherespersecond.HasValue ? FromAtmospheresPerSecond(atmospherespersecond.Value) : default(PressureChangeRate?); + } + + /// + /// Get nullable PressureChangeRate from nullable KilopascalsPerSecond. + /// + public static PressureChangeRate? FromKilopascalsPerSecond(QuantityValue? kilopascalspersecond) + { + return kilopascalspersecond.HasValue ? FromKilopascalsPerSecond(kilopascalspersecond.Value) : default(PressureChangeRate?); + } + + /// + /// Get nullable PressureChangeRate from nullable MegapascalsPerSecond. + /// + public static PressureChangeRate? FromMegapascalsPerSecond(QuantityValue? megapascalspersecond) + { + return megapascalspersecond.HasValue ? FromMegapascalsPerSecond(megapascalspersecond.Value) : default(PressureChangeRate?); + } + + /// + /// Get nullable PressureChangeRate from nullable PascalsPerSecond. + /// + public static PressureChangeRate? FromPascalsPerSecond(QuantityValue? pascalspersecond) + { + return pascalspersecond.HasValue ? FromPascalsPerSecond(pascalspersecond.Value) : default(PressureChangeRate?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// PressureChangeRate unit value. + public static PressureChangeRate? From(QuantityValue? value, PressureChangeRateUnit fromUnit) + { + return value.HasValue ? new PressureChangeRate((double)value.Value, fromUnit) : default(PressureChangeRate?); + } + + #endregion + + #region Arithmetic Operators + + public static PressureChangeRate operator -(PressureChangeRate right) + { + return new PressureChangeRate(-right.Value, right.Unit); + } + + public static PressureChangeRate operator +(PressureChangeRate left, PressureChangeRate right) + { + return new PressureChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static PressureChangeRate operator -(PressureChangeRate left, PressureChangeRate right) + { + return new PressureChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static PressureChangeRate operator *(double left, PressureChangeRate right) + { + return new PressureChangeRate(left * right.Value, right.Unit); + } + + public static PressureChangeRate operator *(PressureChangeRate left, double right) + { + return new PressureChangeRate(left.Value * right, left.Unit); + } + + public static PressureChangeRate operator /(PressureChangeRate left, double right) + { + return new PressureChangeRate(left.Value / right, left.Unit); + } + + public static double operator /(PressureChangeRate left, PressureChangeRate right) + { + return left.PascalsPerSecond / right.PascalsPerSecond; + } + + #endregion + + public static bool operator <=(PressureChangeRate left, PressureChangeRate right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(PressureChangeRate left, PressureChangeRate right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(PressureChangeRate left, PressureChangeRate right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(PressureChangeRate left, PressureChangeRate right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(PressureChangeRate left, PressureChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(PressureChangeRate left, PressureChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Ratio.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Ratio.NetFramework.g.cs index 73aad2a23c..36fca3f0d0 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Ratio.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Ratio.NetFramework.g.cs @@ -59,5 +59,141 @@ public partial struct Ratio : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Ratio from nullable DecimalFractions. + /// + public static Ratio? FromDecimalFractions(QuantityValue? decimalfractions) + { + return decimalfractions.HasValue ? FromDecimalFractions(decimalfractions.Value) : default(Ratio?); + } + + /// + /// Get nullable Ratio from nullable PartsPerBillion. + /// + public static Ratio? FromPartsPerBillion(QuantityValue? partsperbillion) + { + return partsperbillion.HasValue ? FromPartsPerBillion(partsperbillion.Value) : default(Ratio?); + } + + /// + /// Get nullable Ratio from nullable PartsPerMillion. + /// + public static Ratio? FromPartsPerMillion(QuantityValue? partspermillion) + { + return partspermillion.HasValue ? FromPartsPerMillion(partspermillion.Value) : default(Ratio?); + } + + /// + /// Get nullable Ratio from nullable PartsPerThousand. + /// + public static Ratio? FromPartsPerThousand(QuantityValue? partsperthousand) + { + return partsperthousand.HasValue ? FromPartsPerThousand(partsperthousand.Value) : default(Ratio?); + } + + /// + /// Get nullable Ratio from nullable PartsPerTrillion. + /// + public static Ratio? FromPartsPerTrillion(QuantityValue? partspertrillion) + { + return partspertrillion.HasValue ? FromPartsPerTrillion(partspertrillion.Value) : default(Ratio?); + } + + /// + /// Get nullable Ratio from nullable Percent. + /// + public static Ratio? FromPercent(QuantityValue? percent) + { + return percent.HasValue ? FromPercent(percent.Value) : default(Ratio?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Ratio unit value. + public static Ratio? From(QuantityValue? value, RatioUnit fromUnit) + { + return value.HasValue ? new Ratio((double)value.Value, fromUnit) : default(Ratio?); + } + + #endregion + + #region Arithmetic Operators + + public static Ratio operator -(Ratio right) + { + return new Ratio(-right.Value, right.Unit); + } + + public static Ratio operator +(Ratio left, Ratio right) + { + return new Ratio(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Ratio operator -(Ratio left, Ratio right) + { + return new Ratio(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Ratio operator *(double left, Ratio right) + { + return new Ratio(left * right.Value, right.Unit); + } + + public static Ratio operator *(Ratio left, double right) + { + return new Ratio(left.Value * right, left.Unit); + } + + public static Ratio operator /(Ratio left, double right) + { + return new Ratio(left.Value / right, left.Unit); + } + + public static double operator /(Ratio left, Ratio right) + { + return left.DecimalFractions / right.DecimalFractions; + } + + #endregion + + public static bool operator <=(Ratio left, Ratio right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Ratio left, Ratio right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Ratio left, Ratio right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Ratio left, Ratio right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Ratio left, Ratio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Ratio left, Ratio right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactiveEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactiveEnergy.NetFramework.g.cs index 7c88df9f4f..311f4714a1 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactiveEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactiveEnergy.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct ReactiveEnergy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ReactiveEnergy from nullable KilovoltampereReactiveHours. + /// + public static ReactiveEnergy? FromKilovoltampereReactiveHours(QuantityValue? kilovoltamperereactivehours) + { + return kilovoltamperereactivehours.HasValue ? FromKilovoltampereReactiveHours(kilovoltamperereactivehours.Value) : default(ReactiveEnergy?); + } + + /// + /// Get nullable ReactiveEnergy from nullable MegavoltampereReactiveHours. + /// + public static ReactiveEnergy? FromMegavoltampereReactiveHours(QuantityValue? megavoltamperereactivehours) + { + return megavoltamperereactivehours.HasValue ? FromMegavoltampereReactiveHours(megavoltamperereactivehours.Value) : default(ReactiveEnergy?); + } + + /// + /// Get nullable ReactiveEnergy from nullable VoltampereReactiveHours. + /// + public static ReactiveEnergy? FromVoltampereReactiveHours(QuantityValue? voltamperereactivehours) + { + return voltamperereactivehours.HasValue ? FromVoltampereReactiveHours(voltamperereactivehours.Value) : default(ReactiveEnergy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ReactiveEnergy unit value. + public static ReactiveEnergy? From(QuantityValue? value, ReactiveEnergyUnit fromUnit) + { + return value.HasValue ? new ReactiveEnergy((double)value.Value, fromUnit) : default(ReactiveEnergy?); + } + + #endregion + + #region Arithmetic Operators + + public static ReactiveEnergy operator -(ReactiveEnergy right) + { + return new ReactiveEnergy(-right.Value, right.Unit); + } + + public static ReactiveEnergy operator +(ReactiveEnergy left, ReactiveEnergy right) + { + return new ReactiveEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ReactiveEnergy operator -(ReactiveEnergy left, ReactiveEnergy right) + { + return new ReactiveEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ReactiveEnergy operator *(double left, ReactiveEnergy right) + { + return new ReactiveEnergy(left * right.Value, right.Unit); + } + + public static ReactiveEnergy operator *(ReactiveEnergy left, double right) + { + return new ReactiveEnergy(left.Value * right, left.Unit); + } + + public static ReactiveEnergy operator /(ReactiveEnergy left, double right) + { + return new ReactiveEnergy(left.Value / right, left.Unit); + } + + public static double operator /(ReactiveEnergy left, ReactiveEnergy right) + { + return left.VoltampereReactiveHours / right.VoltampereReactiveHours; + } + + #endregion + + public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ReactiveEnergy left, ReactiveEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ReactiveEnergy left, ReactiveEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactivePower.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactivePower.NetFramework.g.cs index a859ca28f8..021c531d3c 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactivePower.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ReactivePower.NetFramework.g.cs @@ -59,5 +59,125 @@ public partial struct ReactivePower : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ReactivePower from nullable GigavoltamperesReactive. + /// + public static ReactivePower? FromGigavoltamperesReactive(QuantityValue? gigavoltamperesreactive) + { + return gigavoltamperesreactive.HasValue ? FromGigavoltamperesReactive(gigavoltamperesreactive.Value) : default(ReactivePower?); + } + + /// + /// Get nullable ReactivePower from nullable KilovoltamperesReactive. + /// + public static ReactivePower? FromKilovoltamperesReactive(QuantityValue? kilovoltamperesreactive) + { + return kilovoltamperesreactive.HasValue ? FromKilovoltamperesReactive(kilovoltamperesreactive.Value) : default(ReactivePower?); + } + + /// + /// Get nullable ReactivePower from nullable MegavoltamperesReactive. + /// + public static ReactivePower? FromMegavoltamperesReactive(QuantityValue? megavoltamperesreactive) + { + return megavoltamperesreactive.HasValue ? FromMegavoltamperesReactive(megavoltamperesreactive.Value) : default(ReactivePower?); + } + + /// + /// Get nullable ReactivePower from nullable VoltamperesReactive. + /// + public static ReactivePower? FromVoltamperesReactive(QuantityValue? voltamperesreactive) + { + return voltamperesreactive.HasValue ? FromVoltamperesReactive(voltamperesreactive.Value) : default(ReactivePower?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ReactivePower unit value. + public static ReactivePower? From(QuantityValue? value, ReactivePowerUnit fromUnit) + { + return value.HasValue ? new ReactivePower((double)value.Value, fromUnit) : default(ReactivePower?); + } + + #endregion + + #region Arithmetic Operators + + public static ReactivePower operator -(ReactivePower right) + { + return new ReactivePower(-right.Value, right.Unit); + } + + public static ReactivePower operator +(ReactivePower left, ReactivePower right) + { + return new ReactivePower(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ReactivePower operator -(ReactivePower left, ReactivePower right) + { + return new ReactivePower(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ReactivePower operator *(double left, ReactivePower right) + { + return new ReactivePower(left * right.Value, right.Unit); + } + + public static ReactivePower operator *(ReactivePower left, double right) + { + return new ReactivePower(left.Value * right, left.Unit); + } + + public static ReactivePower operator /(ReactivePower left, double right) + { + return new ReactivePower(left.Value / right, left.Unit); + } + + public static double operator /(ReactivePower left, ReactivePower right) + { + return left.VoltamperesReactive / right.VoltamperesReactive; + } + + #endregion + + public static bool operator <=(ReactivePower left, ReactivePower right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ReactivePower left, ReactivePower right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ReactivePower left, ReactivePower right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ReactivePower left, ReactivePower right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ReactivePower left, ReactivePower right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ReactivePower left, ReactivePower right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalAcceleration.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalAcceleration.NetFramework.g.cs index b8d283efde..645882fc98 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalAcceleration.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalAcceleration.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct RotationalAcceleration : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable RotationalAcceleration from nullable DegreesPerSecondSquared. + /// + public static RotationalAcceleration? FromDegreesPerSecondSquared(QuantityValue? degreespersecondsquared) + { + return degreespersecondsquared.HasValue ? FromDegreesPerSecondSquared(degreespersecondsquared.Value) : default(RotationalAcceleration?); + } + + /// + /// Get nullable RotationalAcceleration from nullable RadiansPerSecondSquared. + /// + public static RotationalAcceleration? FromRadiansPerSecondSquared(QuantityValue? radianspersecondsquared) + { + return radianspersecondsquared.HasValue ? FromRadiansPerSecondSquared(radianspersecondsquared.Value) : default(RotationalAcceleration?); + } + + /// + /// Get nullable RotationalAcceleration from nullable RevolutionsPerMinutePerSecond. + /// + public static RotationalAcceleration? FromRevolutionsPerMinutePerSecond(QuantityValue? revolutionsperminutepersecond) + { + return revolutionsperminutepersecond.HasValue ? FromRevolutionsPerMinutePerSecond(revolutionsperminutepersecond.Value) : default(RotationalAcceleration?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalAcceleration unit value. + public static RotationalAcceleration? From(QuantityValue? value, RotationalAccelerationUnit fromUnit) + { + return value.HasValue ? new RotationalAcceleration((double)value.Value, fromUnit) : default(RotationalAcceleration?); + } + + #endregion + + #region Arithmetic Operators + + public static RotationalAcceleration operator -(RotationalAcceleration right) + { + return new RotationalAcceleration(-right.Value, right.Unit); + } + + public static RotationalAcceleration operator +(RotationalAcceleration left, RotationalAcceleration right) + { + return new RotationalAcceleration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalAcceleration operator -(RotationalAcceleration left, RotationalAcceleration right) + { + return new RotationalAcceleration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalAcceleration operator *(double left, RotationalAcceleration right) + { + return new RotationalAcceleration(left * right.Value, right.Unit); + } + + public static RotationalAcceleration operator *(RotationalAcceleration left, double right) + { + return new RotationalAcceleration(left.Value * right, left.Unit); + } + + public static RotationalAcceleration operator /(RotationalAcceleration left, double right) + { + return new RotationalAcceleration(left.Value / right, left.Unit); + } + + public static double operator /(RotationalAcceleration left, RotationalAcceleration right) + { + return left.RadiansPerSecondSquared / right.RadiansPerSecondSquared; + } + + #endregion + + public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(RotationalAcceleration left, RotationalAcceleration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(RotationalAcceleration left, RotationalAcceleration right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalSpeed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalSpeed.NetFramework.g.cs index 4be9cd0e60..4cc2fe8d4c 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalSpeed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalSpeed.NetFramework.g.cs @@ -59,5 +59,197 @@ public partial struct RotationalSpeed : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable RotationalSpeed from nullable CentiradiansPerSecond. + /// + public static RotationalSpeed? FromCentiradiansPerSecond(QuantityValue? centiradianspersecond) + { + return centiradianspersecond.HasValue ? FromCentiradiansPerSecond(centiradianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable DeciradiansPerSecond. + /// + public static RotationalSpeed? FromDeciradiansPerSecond(QuantityValue? deciradianspersecond) + { + return deciradianspersecond.HasValue ? FromDeciradiansPerSecond(deciradianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable DegreesPerMinute. + /// + public static RotationalSpeed? FromDegreesPerMinute(QuantityValue? degreesperminute) + { + return degreesperminute.HasValue ? FromDegreesPerMinute(degreesperminute.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable DegreesPerSecond. + /// + public static RotationalSpeed? FromDegreesPerSecond(QuantityValue? degreespersecond) + { + return degreespersecond.HasValue ? FromDegreesPerSecond(degreespersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable MicrodegreesPerSecond. + /// + public static RotationalSpeed? FromMicrodegreesPerSecond(QuantityValue? microdegreespersecond) + { + return microdegreespersecond.HasValue ? FromMicrodegreesPerSecond(microdegreespersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable MicroradiansPerSecond. + /// + public static RotationalSpeed? FromMicroradiansPerSecond(QuantityValue? microradianspersecond) + { + return microradianspersecond.HasValue ? FromMicroradiansPerSecond(microradianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable MillidegreesPerSecond. + /// + public static RotationalSpeed? FromMillidegreesPerSecond(QuantityValue? millidegreespersecond) + { + return millidegreespersecond.HasValue ? FromMillidegreesPerSecond(millidegreespersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable MilliradiansPerSecond. + /// + public static RotationalSpeed? FromMilliradiansPerSecond(QuantityValue? milliradianspersecond) + { + return milliradianspersecond.HasValue ? FromMilliradiansPerSecond(milliradianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable NanodegreesPerSecond. + /// + public static RotationalSpeed? FromNanodegreesPerSecond(QuantityValue? nanodegreespersecond) + { + return nanodegreespersecond.HasValue ? FromNanodegreesPerSecond(nanodegreespersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable NanoradiansPerSecond. + /// + public static RotationalSpeed? FromNanoradiansPerSecond(QuantityValue? nanoradianspersecond) + { + return nanoradianspersecond.HasValue ? FromNanoradiansPerSecond(nanoradianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable RadiansPerSecond. + /// + public static RotationalSpeed? FromRadiansPerSecond(QuantityValue? radianspersecond) + { + return radianspersecond.HasValue ? FromRadiansPerSecond(radianspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable RevolutionsPerMinute. + /// + public static RotationalSpeed? FromRevolutionsPerMinute(QuantityValue? revolutionsperminute) + { + return revolutionsperminute.HasValue ? FromRevolutionsPerMinute(revolutionsperminute.Value) : default(RotationalSpeed?); + } + + /// + /// Get nullable RotationalSpeed from nullable RevolutionsPerSecond. + /// + public static RotationalSpeed? FromRevolutionsPerSecond(QuantityValue? revolutionspersecond) + { + return revolutionspersecond.HasValue ? FromRevolutionsPerSecond(revolutionspersecond.Value) : default(RotationalSpeed?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalSpeed unit value. + public static RotationalSpeed? From(QuantityValue? value, RotationalSpeedUnit fromUnit) + { + return value.HasValue ? new RotationalSpeed((double)value.Value, fromUnit) : default(RotationalSpeed?); + } + + #endregion + + #region Arithmetic Operators + + public static RotationalSpeed operator -(RotationalSpeed right) + { + return new RotationalSpeed(-right.Value, right.Unit); + } + + public static RotationalSpeed operator +(RotationalSpeed left, RotationalSpeed right) + { + return new RotationalSpeed(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalSpeed operator -(RotationalSpeed left, RotationalSpeed right) + { + return new RotationalSpeed(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalSpeed operator *(double left, RotationalSpeed right) + { + return new RotationalSpeed(left * right.Value, right.Unit); + } + + public static RotationalSpeed operator *(RotationalSpeed left, double right) + { + return new RotationalSpeed(left.Value * right, left.Unit); + } + + public static RotationalSpeed operator /(RotationalSpeed left, double right) + { + return new RotationalSpeed(left.Value / right, left.Unit); + } + + public static double operator /(RotationalSpeed left, RotationalSpeed right) + { + return left.RadiansPerSecond / right.RadiansPerSecond; + } + + #endregion + + public static bool operator <=(RotationalSpeed left, RotationalSpeed right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(RotationalSpeed left, RotationalSpeed right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(RotationalSpeed left, RotationalSpeed right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(RotationalSpeed left, RotationalSpeed right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(RotationalSpeed left, RotationalSpeed right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(RotationalSpeed left, RotationalSpeed right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffness.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffness.NetFramework.g.cs index bd23ebb0a2..3bb6e0e610 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffness.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffness.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct RotationalStiffness : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable RotationalStiffness from nullable KilonewtonMetersPerRadian. + /// + public static RotationalStiffness? FromKilonewtonMetersPerRadian(QuantityValue? kilonewtonmetersperradian) + { + return kilonewtonmetersperradian.HasValue ? FromKilonewtonMetersPerRadian(kilonewtonmetersperradian.Value) : default(RotationalStiffness?); + } + + /// + /// Get nullable RotationalStiffness from nullable MeganewtonMetersPerRadian. + /// + public static RotationalStiffness? FromMeganewtonMetersPerRadian(QuantityValue? meganewtonmetersperradian) + { + return meganewtonmetersperradian.HasValue ? FromMeganewtonMetersPerRadian(meganewtonmetersperradian.Value) : default(RotationalStiffness?); + } + + /// + /// Get nullable RotationalStiffness from nullable NewtonMetersPerRadian. + /// + public static RotationalStiffness? FromNewtonMetersPerRadian(QuantityValue? newtonmetersperradian) + { + return newtonmetersperradian.HasValue ? FromNewtonMetersPerRadian(newtonmetersperradian.Value) : default(RotationalStiffness?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalStiffness unit value. + public static RotationalStiffness? From(QuantityValue? value, RotationalStiffnessUnit fromUnit) + { + return value.HasValue ? new RotationalStiffness((double)value.Value, fromUnit) : default(RotationalStiffness?); + } + + #endregion + + #region Arithmetic Operators + + public static RotationalStiffness operator -(RotationalStiffness right) + { + return new RotationalStiffness(-right.Value, right.Unit); + } + + public static RotationalStiffness operator +(RotationalStiffness left, RotationalStiffness right) + { + return new RotationalStiffness(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalStiffness operator -(RotationalStiffness left, RotationalStiffness right) + { + return new RotationalStiffness(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalStiffness operator *(double left, RotationalStiffness right) + { + return new RotationalStiffness(left * right.Value, right.Unit); + } + + public static RotationalStiffness operator *(RotationalStiffness left, double right) + { + return new RotationalStiffness(left.Value * right, left.Unit); + } + + public static RotationalStiffness operator /(RotationalStiffness left, double right) + { + return new RotationalStiffness(left.Value / right, left.Unit); + } + + public static double operator /(RotationalStiffness left, RotationalStiffness right) + { + return left.NewtonMetersPerRadian / right.NewtonMetersPerRadian; + } + + #endregion + + public static bool operator <=(RotationalStiffness left, RotationalStiffness right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(RotationalStiffness left, RotationalStiffness right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(RotationalStiffness left, RotationalStiffness right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(RotationalStiffness left, RotationalStiffness right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(RotationalStiffness left, RotationalStiffness right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(RotationalStiffness left, RotationalStiffness right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffnessPerLength.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffnessPerLength.NetFramework.g.cs index 5cf6349084..7ae3c70108 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffnessPerLength.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/RotationalStiffnessPerLength.NetFramework.g.cs @@ -59,5 +59,117 @@ public partial struct RotationalStiffnessPerLength : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable RotationalStiffnessPerLength from nullable KilonewtonMetersPerRadianPerMeter. + /// + public static RotationalStiffnessPerLength? FromKilonewtonMetersPerRadianPerMeter(QuantityValue? kilonewtonmetersperradianpermeter) + { + return kilonewtonmetersperradianpermeter.HasValue ? FromKilonewtonMetersPerRadianPerMeter(kilonewtonmetersperradianpermeter.Value) : default(RotationalStiffnessPerLength?); + } + + /// + /// Get nullable RotationalStiffnessPerLength from nullable MeganewtonMetersPerRadianPerMeter. + /// + public static RotationalStiffnessPerLength? FromMeganewtonMetersPerRadianPerMeter(QuantityValue? meganewtonmetersperradianpermeter) + { + return meganewtonmetersperradianpermeter.HasValue ? FromMeganewtonMetersPerRadianPerMeter(meganewtonmetersperradianpermeter.Value) : default(RotationalStiffnessPerLength?); + } + + /// + /// Get nullable RotationalStiffnessPerLength from nullable NewtonMetersPerRadianPerMeter. + /// + public static RotationalStiffnessPerLength? FromNewtonMetersPerRadianPerMeter(QuantityValue? newtonmetersperradianpermeter) + { + return newtonmetersperradianpermeter.HasValue ? FromNewtonMetersPerRadianPerMeter(newtonmetersperradianpermeter.Value) : default(RotationalStiffnessPerLength?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// RotationalStiffnessPerLength unit value. + public static RotationalStiffnessPerLength? From(QuantityValue? value, RotationalStiffnessPerLengthUnit fromUnit) + { + return value.HasValue ? new RotationalStiffnessPerLength((double)value.Value, fromUnit) : default(RotationalStiffnessPerLength?); + } + + #endregion + + #region Arithmetic Operators + + public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right) + { + return new RotationalStiffnessPerLength(-right.Value, right.Unit); + } + + public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return new RotationalStiffnessPerLength(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return new RotationalStiffnessPerLength(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right) + { + return new RotationalStiffnessPerLength(left * right.Value, right.Unit); + } + + public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right) + { + return new RotationalStiffnessPerLength(left.Value * right, left.Unit); + } + + public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right) + { + return new RotationalStiffnessPerLength(left.Value / right, left.Unit); + } + + public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.NewtonMetersPerRadianPerMeter / right.NewtonMetersPerRadianPerMeter; + } + + #endregion + + public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/SolidAngle.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/SolidAngle.NetFramework.g.cs index cd9b90db52..d5f8192f75 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/SolidAngle.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/SolidAngle.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct SolidAngle : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable SolidAngle from nullable Steradians. + /// + public static SolidAngle? FromSteradians(QuantityValue? steradians) + { + return steradians.HasValue ? FromSteradians(steradians.Value) : default(SolidAngle?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SolidAngle unit value. + public static SolidAngle? From(QuantityValue? value, SolidAngleUnit fromUnit) + { + return value.HasValue ? new SolidAngle((double)value.Value, fromUnit) : default(SolidAngle?); + } + + #endregion + + #region Arithmetic Operators + + public static SolidAngle operator -(SolidAngle right) + { + return new SolidAngle(-right.Value, right.Unit); + } + + public static SolidAngle operator +(SolidAngle left, SolidAngle right) + { + return new SolidAngle(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SolidAngle operator -(SolidAngle left, SolidAngle right) + { + return new SolidAngle(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SolidAngle operator *(double left, SolidAngle right) + { + return new SolidAngle(left * right.Value, right.Unit); + } + + public static SolidAngle operator *(SolidAngle left, double right) + { + return new SolidAngle(left.Value * right, left.Unit); + } + + public static SolidAngle operator /(SolidAngle left, double right) + { + return new SolidAngle(left.Value / right, left.Unit); + } + + public static double operator /(SolidAngle left, SolidAngle right) + { + return left.Steradians / right.Steradians; + } + + #endregion + + public static bool operator <=(SolidAngle left, SolidAngle right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(SolidAngle left, SolidAngle right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(SolidAngle left, SolidAngle right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(SolidAngle left, SolidAngle right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(SolidAngle left, SolidAngle right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(SolidAngle left, SolidAngle right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEnergy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEnergy.NetFramework.g.cs index 8e3a969f95..97a9f8a9c6 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEnergy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEnergy.NetFramework.g.cs @@ -59,5 +59,157 @@ public partial struct SpecificEnergy : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable SpecificEnergy from nullable CaloriesPerGram. + /// + public static SpecificEnergy? FromCaloriesPerGram(QuantityValue? caloriespergram) + { + return caloriespergram.HasValue ? FromCaloriesPerGram(caloriespergram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable JoulesPerKilogram. + /// + public static SpecificEnergy? FromJoulesPerKilogram(QuantityValue? joulesperkilogram) + { + return joulesperkilogram.HasValue ? FromJoulesPerKilogram(joulesperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable KilocaloriesPerGram. + /// + public static SpecificEnergy? FromKilocaloriesPerGram(QuantityValue? kilocaloriespergram) + { + return kilocaloriespergram.HasValue ? FromKilocaloriesPerGram(kilocaloriespergram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable KilojoulesPerKilogram. + /// + public static SpecificEnergy? FromKilojoulesPerKilogram(QuantityValue? kilojoulesperkilogram) + { + return kilojoulesperkilogram.HasValue ? FromKilojoulesPerKilogram(kilojoulesperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable KilowattHoursPerKilogram. + /// + public static SpecificEnergy? FromKilowattHoursPerKilogram(QuantityValue? kilowatthoursperkilogram) + { + return kilowatthoursperkilogram.HasValue ? FromKilowattHoursPerKilogram(kilowatthoursperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable MegajoulesPerKilogram. + /// + public static SpecificEnergy? FromMegajoulesPerKilogram(QuantityValue? megajoulesperkilogram) + { + return megajoulesperkilogram.HasValue ? FromMegajoulesPerKilogram(megajoulesperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable MegawattHoursPerKilogram. + /// + public static SpecificEnergy? FromMegawattHoursPerKilogram(QuantityValue? megawatthoursperkilogram) + { + return megawatthoursperkilogram.HasValue ? FromMegawattHoursPerKilogram(megawatthoursperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Get nullable SpecificEnergy from nullable WattHoursPerKilogram. + /// + public static SpecificEnergy? FromWattHoursPerKilogram(QuantityValue? watthoursperkilogram) + { + return watthoursperkilogram.HasValue ? FromWattHoursPerKilogram(watthoursperkilogram.Value) : default(SpecificEnergy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificEnergy unit value. + public static SpecificEnergy? From(QuantityValue? value, SpecificEnergyUnit fromUnit) + { + return value.HasValue ? new SpecificEnergy((double)value.Value, fromUnit) : default(SpecificEnergy?); + } + + #endregion + + #region Arithmetic Operators + + public static SpecificEnergy operator -(SpecificEnergy right) + { + return new SpecificEnergy(-right.Value, right.Unit); + } + + public static SpecificEnergy operator +(SpecificEnergy left, SpecificEnergy right) + { + return new SpecificEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificEnergy operator -(SpecificEnergy left, SpecificEnergy right) + { + return new SpecificEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificEnergy operator *(double left, SpecificEnergy right) + { + return new SpecificEnergy(left * right.Value, right.Unit); + } + + public static SpecificEnergy operator *(SpecificEnergy left, double right) + { + return new SpecificEnergy(left.Value * right, left.Unit); + } + + public static SpecificEnergy operator /(SpecificEnergy left, double right) + { + return new SpecificEnergy(left.Value / right, left.Unit); + } + + public static double operator /(SpecificEnergy left, SpecificEnergy right) + { + return left.JoulesPerKilogram / right.JoulesPerKilogram; + } + + #endregion + + public static bool operator <=(SpecificEnergy left, SpecificEnergy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(SpecificEnergy left, SpecificEnergy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(SpecificEnergy left, SpecificEnergy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(SpecificEnergy left, SpecificEnergy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(SpecificEnergy left, SpecificEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(SpecificEnergy left, SpecificEnergy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEntropy.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEntropy.NetFramework.g.cs index 6400ad07d3..98930f084a 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEntropy.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificEntropy.NetFramework.g.cs @@ -59,5 +59,157 @@ public partial struct SpecificEntropy : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable SpecificEntropy from nullable CaloriesPerGramKelvin. + /// + public static SpecificEntropy? FromCaloriesPerGramKelvin(QuantityValue? caloriespergramkelvin) + { + return caloriespergramkelvin.HasValue ? FromCaloriesPerGramKelvin(caloriespergramkelvin.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable JoulesPerKilogramDegreeCelsius. + /// + public static SpecificEntropy? FromJoulesPerKilogramDegreeCelsius(QuantityValue? joulesperkilogramdegreecelsius) + { + return joulesperkilogramdegreecelsius.HasValue ? FromJoulesPerKilogramDegreeCelsius(joulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable JoulesPerKilogramKelvin. + /// + public static SpecificEntropy? FromJoulesPerKilogramKelvin(QuantityValue? joulesperkilogramkelvin) + { + return joulesperkilogramkelvin.HasValue ? FromJoulesPerKilogramKelvin(joulesperkilogramkelvin.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable KilocaloriesPerGramKelvin. + /// + public static SpecificEntropy? FromKilocaloriesPerGramKelvin(QuantityValue? kilocaloriespergramkelvin) + { + return kilocaloriespergramkelvin.HasValue ? FromKilocaloriesPerGramKelvin(kilocaloriespergramkelvin.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramDegreeCelsius. + /// + public static SpecificEntropy? FromKilojoulesPerKilogramDegreeCelsius(QuantityValue? kilojoulesperkilogramdegreecelsius) + { + return kilojoulesperkilogramdegreecelsius.HasValue ? FromKilojoulesPerKilogramDegreeCelsius(kilojoulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramKelvin. + /// + public static SpecificEntropy? FromKilojoulesPerKilogramKelvin(QuantityValue? kilojoulesperkilogramkelvin) + { + return kilojoulesperkilogramkelvin.HasValue ? FromKilojoulesPerKilogramKelvin(kilojoulesperkilogramkelvin.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramDegreeCelsius. + /// + public static SpecificEntropy? FromMegajoulesPerKilogramDegreeCelsius(QuantityValue? megajoulesperkilogramdegreecelsius) + { + return megajoulesperkilogramdegreecelsius.HasValue ? FromMegajoulesPerKilogramDegreeCelsius(megajoulesperkilogramdegreecelsius.Value) : default(SpecificEntropy?); + } + + /// + /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramKelvin. + /// + public static SpecificEntropy? FromMegajoulesPerKilogramKelvin(QuantityValue? megajoulesperkilogramkelvin) + { + return megajoulesperkilogramkelvin.HasValue ? FromMegajoulesPerKilogramKelvin(megajoulesperkilogramkelvin.Value) : default(SpecificEntropy?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificEntropy unit value. + public static SpecificEntropy? From(QuantityValue? value, SpecificEntropyUnit fromUnit) + { + return value.HasValue ? new SpecificEntropy((double)value.Value, fromUnit) : default(SpecificEntropy?); + } + + #endregion + + #region Arithmetic Operators + + public static SpecificEntropy operator -(SpecificEntropy right) + { + return new SpecificEntropy(-right.Value, right.Unit); + } + + public static SpecificEntropy operator +(SpecificEntropy left, SpecificEntropy right) + { + return new SpecificEntropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificEntropy operator -(SpecificEntropy left, SpecificEntropy right) + { + return new SpecificEntropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificEntropy operator *(double left, SpecificEntropy right) + { + return new SpecificEntropy(left * right.Value, right.Unit); + } + + public static SpecificEntropy operator *(SpecificEntropy left, double right) + { + return new SpecificEntropy(left.Value * right, left.Unit); + } + + public static SpecificEntropy operator /(SpecificEntropy left, double right) + { + return new SpecificEntropy(left.Value / right, left.Unit); + } + + public static double operator /(SpecificEntropy left, SpecificEntropy right) + { + return left.JoulesPerKilogramKelvin / right.JoulesPerKilogramKelvin; + } + + #endregion + + public static bool operator <=(SpecificEntropy left, SpecificEntropy right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(SpecificEntropy left, SpecificEntropy right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(SpecificEntropy left, SpecificEntropy right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(SpecificEntropy left, SpecificEntropy right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(SpecificEntropy left, SpecificEntropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(SpecificEntropy left, SpecificEntropy right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificVolume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificVolume.NetFramework.g.cs index 5eedcdb86b..ce258ebce4 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificVolume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificVolume.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct SpecificVolume : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable SpecificVolume from nullable CubicMetersPerKilogram. + /// + public static SpecificVolume? FromCubicMetersPerKilogram(QuantityValue? cubicmetersperkilogram) + { + return cubicmetersperkilogram.HasValue ? FromCubicMetersPerKilogram(cubicmetersperkilogram.Value) : default(SpecificVolume?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificVolume unit value. + public static SpecificVolume? From(QuantityValue? value, SpecificVolumeUnit fromUnit) + { + return value.HasValue ? new SpecificVolume((double)value.Value, fromUnit) : default(SpecificVolume?); + } + + #endregion + + #region Arithmetic Operators + + public static SpecificVolume operator -(SpecificVolume right) + { + return new SpecificVolume(-right.Value, right.Unit); + } + + public static SpecificVolume operator +(SpecificVolume left, SpecificVolume right) + { + return new SpecificVolume(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificVolume operator -(SpecificVolume left, SpecificVolume right) + { + return new SpecificVolume(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificVolume operator *(double left, SpecificVolume right) + { + return new SpecificVolume(left * right.Value, right.Unit); + } + + public static SpecificVolume operator *(SpecificVolume left, double right) + { + return new SpecificVolume(left.Value * right, left.Unit); + } + + public static SpecificVolume operator /(SpecificVolume left, double right) + { + return new SpecificVolume(left.Value / right, left.Unit); + } + + public static double operator /(SpecificVolume left, SpecificVolume right) + { + return left.CubicMetersPerKilogram / right.CubicMetersPerKilogram; + } + + #endregion + + public static bool operator <=(SpecificVolume left, SpecificVolume right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(SpecificVolume left, SpecificVolume right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(SpecificVolume left, SpecificVolume right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(SpecificVolume left, SpecificVolume right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(SpecificVolume left, SpecificVolume right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(SpecificVolume left, SpecificVolume right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificWeight.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificWeight.NetFramework.g.cs index dce0bf6284..faad604b80 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificWeight.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/SpecificWeight.NetFramework.g.cs @@ -59,5 +59,229 @@ public partial struct SpecificWeight : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicCentimeter. + /// + public static SpecificWeight? FromKilogramsForcePerCubicCentimeter(QuantityValue? kilogramsforcepercubiccentimeter) + { + return kilogramsforcepercubiccentimeter.HasValue ? FromKilogramsForcePerCubicCentimeter(kilogramsforcepercubiccentimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMeter. + /// + public static SpecificWeight? FromKilogramsForcePerCubicMeter(QuantityValue? kilogramsforcepercubicmeter) + { + return kilogramsforcepercubicmeter.HasValue ? FromKilogramsForcePerCubicMeter(kilogramsforcepercubicmeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMillimeter. + /// + public static SpecificWeight? FromKilogramsForcePerCubicMillimeter(QuantityValue? kilogramsforcepercubicmillimeter) + { + return kilogramsforcepercubicmillimeter.HasValue ? FromKilogramsForcePerCubicMillimeter(kilogramsforcepercubicmillimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicCentimeter. + /// + public static SpecificWeight? FromKilonewtonsPerCubicCentimeter(QuantityValue? kilonewtonspercubiccentimeter) + { + return kilonewtonspercubiccentimeter.HasValue ? FromKilonewtonsPerCubicCentimeter(kilonewtonspercubiccentimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMeter. + /// + public static SpecificWeight? FromKilonewtonsPerCubicMeter(QuantityValue? kilonewtonspercubicmeter) + { + return kilonewtonspercubicmeter.HasValue ? FromKilonewtonsPerCubicMeter(kilonewtonspercubicmeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMillimeter. + /// + public static SpecificWeight? FromKilonewtonsPerCubicMillimeter(QuantityValue? kilonewtonspercubicmillimeter) + { + return kilonewtonspercubicmillimeter.HasValue ? FromKilonewtonsPerCubicMillimeter(kilonewtonspercubicmillimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicFoot. + /// + public static SpecificWeight? FromKilopoundsForcePerCubicFoot(QuantityValue? kilopoundsforcepercubicfoot) + { + return kilopoundsforcepercubicfoot.HasValue ? FromKilopoundsForcePerCubicFoot(kilopoundsforcepercubicfoot.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicInch. + /// + public static SpecificWeight? FromKilopoundsForcePerCubicInch(QuantityValue? kilopoundsforcepercubicinch) + { + return kilopoundsforcepercubicinch.HasValue ? FromKilopoundsForcePerCubicInch(kilopoundsforcepercubicinch.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable MeganewtonsPerCubicMeter. + /// + public static SpecificWeight? FromMeganewtonsPerCubicMeter(QuantityValue? meganewtonspercubicmeter) + { + return meganewtonspercubicmeter.HasValue ? FromMeganewtonsPerCubicMeter(meganewtonspercubicmeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable NewtonsPerCubicCentimeter. + /// + public static SpecificWeight? FromNewtonsPerCubicCentimeter(QuantityValue? newtonspercubiccentimeter) + { + return newtonspercubiccentimeter.HasValue ? FromNewtonsPerCubicCentimeter(newtonspercubiccentimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable NewtonsPerCubicMeter. + /// + public static SpecificWeight? FromNewtonsPerCubicMeter(QuantityValue? newtonspercubicmeter) + { + return newtonspercubicmeter.HasValue ? FromNewtonsPerCubicMeter(newtonspercubicmeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable NewtonsPerCubicMillimeter. + /// + public static SpecificWeight? FromNewtonsPerCubicMillimeter(QuantityValue? newtonspercubicmillimeter) + { + return newtonspercubicmillimeter.HasValue ? FromNewtonsPerCubicMillimeter(newtonspercubicmillimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable PoundsForcePerCubicFoot. + /// + public static SpecificWeight? FromPoundsForcePerCubicFoot(QuantityValue? poundsforcepercubicfoot) + { + return poundsforcepercubicfoot.HasValue ? FromPoundsForcePerCubicFoot(poundsforcepercubicfoot.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable PoundsForcePerCubicInch. + /// + public static SpecificWeight? FromPoundsForcePerCubicInch(QuantityValue? poundsforcepercubicinch) + { + return poundsforcepercubicinch.HasValue ? FromPoundsForcePerCubicInch(poundsforcepercubicinch.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable TonnesForcePerCubicCentimeter. + /// + public static SpecificWeight? FromTonnesForcePerCubicCentimeter(QuantityValue? tonnesforcepercubiccentimeter) + { + return tonnesforcepercubiccentimeter.HasValue ? FromTonnesForcePerCubicCentimeter(tonnesforcepercubiccentimeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMeter. + /// + public static SpecificWeight? FromTonnesForcePerCubicMeter(QuantityValue? tonnesforcepercubicmeter) + { + return tonnesforcepercubicmeter.HasValue ? FromTonnesForcePerCubicMeter(tonnesforcepercubicmeter.Value) : default(SpecificWeight?); + } + + /// + /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMillimeter. + /// + public static SpecificWeight? FromTonnesForcePerCubicMillimeter(QuantityValue? tonnesforcepercubicmillimeter) + { + return tonnesforcepercubicmillimeter.HasValue ? FromTonnesForcePerCubicMillimeter(tonnesforcepercubicmillimeter.Value) : default(SpecificWeight?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// SpecificWeight unit value. + public static SpecificWeight? From(QuantityValue? value, SpecificWeightUnit fromUnit) + { + return value.HasValue ? new SpecificWeight((double)value.Value, fromUnit) : default(SpecificWeight?); + } + + #endregion + + #region Arithmetic Operators + + public static SpecificWeight operator -(SpecificWeight right) + { + return new SpecificWeight(-right.Value, right.Unit); + } + + public static SpecificWeight operator +(SpecificWeight left, SpecificWeight right) + { + return new SpecificWeight(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificWeight operator -(SpecificWeight left, SpecificWeight right) + { + return new SpecificWeight(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static SpecificWeight operator *(double left, SpecificWeight right) + { + return new SpecificWeight(left * right.Value, right.Unit); + } + + public static SpecificWeight operator *(SpecificWeight left, double right) + { + return new SpecificWeight(left.Value * right, left.Unit); + } + + public static SpecificWeight operator /(SpecificWeight left, double right) + { + return new SpecificWeight(left.Value / right, left.Unit); + } + + public static double operator /(SpecificWeight left, SpecificWeight right) + { + return left.NewtonsPerCubicMeter / right.NewtonsPerCubicMeter; + } + + #endregion + + public static bool operator <=(SpecificWeight left, SpecificWeight right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(SpecificWeight left, SpecificWeight right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(SpecificWeight left, SpecificWeight right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(SpecificWeight left, SpecificWeight right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(SpecificWeight left, SpecificWeight right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(SpecificWeight left, SpecificWeight right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Speed.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Speed.NetFramework.g.cs index 08d131af1d..16abbf9129 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Speed.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Speed.NetFramework.g.cs @@ -59,5 +59,349 @@ public partial struct Speed : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Speed from nullable CentimetersPerHour. + /// + public static Speed? FromCentimetersPerHour(QuantityValue? centimetersperhour) + { + return centimetersperhour.HasValue ? FromCentimetersPerHour(centimetersperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable CentimetersPerMinutes. + /// + public static Speed? FromCentimetersPerMinutes(QuantityValue? centimetersperminutes) + { + return centimetersperminutes.HasValue ? FromCentimetersPerMinutes(centimetersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable CentimetersPerSecond. + /// + public static Speed? FromCentimetersPerSecond(QuantityValue? centimeterspersecond) + { + return centimeterspersecond.HasValue ? FromCentimetersPerSecond(centimeterspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable DecimetersPerMinutes. + /// + public static Speed? FromDecimetersPerMinutes(QuantityValue? decimetersperminutes) + { + return decimetersperminutes.HasValue ? FromDecimetersPerMinutes(decimetersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable DecimetersPerSecond. + /// + public static Speed? FromDecimetersPerSecond(QuantityValue? decimeterspersecond) + { + return decimeterspersecond.HasValue ? FromDecimetersPerSecond(decimeterspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable FeetPerHour. + /// + public static Speed? FromFeetPerHour(QuantityValue? feetperhour) + { + return feetperhour.HasValue ? FromFeetPerHour(feetperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable FeetPerMinute. + /// + public static Speed? FromFeetPerMinute(QuantityValue? feetperminute) + { + return feetperminute.HasValue ? FromFeetPerMinute(feetperminute.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable FeetPerSecond. + /// + public static Speed? FromFeetPerSecond(QuantityValue? feetpersecond) + { + return feetpersecond.HasValue ? FromFeetPerSecond(feetpersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable InchesPerHour. + /// + public static Speed? FromInchesPerHour(QuantityValue? inchesperhour) + { + return inchesperhour.HasValue ? FromInchesPerHour(inchesperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable InchesPerMinute. + /// + public static Speed? FromInchesPerMinute(QuantityValue? inchesperminute) + { + return inchesperminute.HasValue ? FromInchesPerMinute(inchesperminute.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable InchesPerSecond. + /// + public static Speed? FromInchesPerSecond(QuantityValue? inchespersecond) + { + return inchespersecond.HasValue ? FromInchesPerSecond(inchespersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable KilometersPerHour. + /// + public static Speed? FromKilometersPerHour(QuantityValue? kilometersperhour) + { + return kilometersperhour.HasValue ? FromKilometersPerHour(kilometersperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable KilometersPerMinutes. + /// + public static Speed? FromKilometersPerMinutes(QuantityValue? kilometersperminutes) + { + return kilometersperminutes.HasValue ? FromKilometersPerMinutes(kilometersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable KilometersPerSecond. + /// + public static Speed? FromKilometersPerSecond(QuantityValue? kilometerspersecond) + { + return kilometerspersecond.HasValue ? FromKilometersPerSecond(kilometerspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable Knots. + /// + public static Speed? FromKnots(QuantityValue? knots) + { + return knots.HasValue ? FromKnots(knots.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MetersPerHour. + /// + public static Speed? FromMetersPerHour(QuantityValue? metersperhour) + { + return metersperhour.HasValue ? FromMetersPerHour(metersperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MetersPerMinutes. + /// + public static Speed? FromMetersPerMinutes(QuantityValue? metersperminutes) + { + return metersperminutes.HasValue ? FromMetersPerMinutes(metersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MetersPerSecond. + /// + public static Speed? FromMetersPerSecond(QuantityValue? meterspersecond) + { + return meterspersecond.HasValue ? FromMetersPerSecond(meterspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MicrometersPerMinutes. + /// + public static Speed? FromMicrometersPerMinutes(QuantityValue? micrometersperminutes) + { + return micrometersperminutes.HasValue ? FromMicrometersPerMinutes(micrometersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MicrometersPerSecond. + /// + public static Speed? FromMicrometersPerSecond(QuantityValue? micrometerspersecond) + { + return micrometerspersecond.HasValue ? FromMicrometersPerSecond(micrometerspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MilesPerHour. + /// + public static Speed? FromMilesPerHour(QuantityValue? milesperhour) + { + return milesperhour.HasValue ? FromMilesPerHour(milesperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MillimetersPerHour. + /// + public static Speed? FromMillimetersPerHour(QuantityValue? millimetersperhour) + { + return millimetersperhour.HasValue ? FromMillimetersPerHour(millimetersperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MillimetersPerMinutes. + /// + public static Speed? FromMillimetersPerMinutes(QuantityValue? millimetersperminutes) + { + return millimetersperminutes.HasValue ? FromMillimetersPerMinutes(millimetersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable MillimetersPerSecond. + /// + public static Speed? FromMillimetersPerSecond(QuantityValue? millimeterspersecond) + { + return millimeterspersecond.HasValue ? FromMillimetersPerSecond(millimeterspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable NanometersPerMinutes. + /// + public static Speed? FromNanometersPerMinutes(QuantityValue? nanometersperminutes) + { + return nanometersperminutes.HasValue ? FromNanometersPerMinutes(nanometersperminutes.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable NanometersPerSecond. + /// + public static Speed? FromNanometersPerSecond(QuantityValue? nanometerspersecond) + { + return nanometerspersecond.HasValue ? FromNanometersPerSecond(nanometerspersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable UsSurveyFeetPerHour. + /// + public static Speed? FromUsSurveyFeetPerHour(QuantityValue? ussurveyfeetperhour) + { + return ussurveyfeetperhour.HasValue ? FromUsSurveyFeetPerHour(ussurveyfeetperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable UsSurveyFeetPerMinute. + /// + public static Speed? FromUsSurveyFeetPerMinute(QuantityValue? ussurveyfeetperminute) + { + return ussurveyfeetperminute.HasValue ? FromUsSurveyFeetPerMinute(ussurveyfeetperminute.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable UsSurveyFeetPerSecond. + /// + public static Speed? FromUsSurveyFeetPerSecond(QuantityValue? ussurveyfeetpersecond) + { + return ussurveyfeetpersecond.HasValue ? FromUsSurveyFeetPerSecond(ussurveyfeetpersecond.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable YardsPerHour. + /// + public static Speed? FromYardsPerHour(QuantityValue? yardsperhour) + { + return yardsperhour.HasValue ? FromYardsPerHour(yardsperhour.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable YardsPerMinute. + /// + public static Speed? FromYardsPerMinute(QuantityValue? yardsperminute) + { + return yardsperminute.HasValue ? FromYardsPerMinute(yardsperminute.Value) : default(Speed?); + } + + /// + /// Get nullable Speed from nullable YardsPerSecond. + /// + public static Speed? FromYardsPerSecond(QuantityValue? yardspersecond) + { + return yardspersecond.HasValue ? FromYardsPerSecond(yardspersecond.Value) : default(Speed?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Speed unit value. + public static Speed? From(QuantityValue? value, SpeedUnit fromUnit) + { + return value.HasValue ? new Speed((double)value.Value, fromUnit) : default(Speed?); + } + + #endregion + + #region Arithmetic Operators + + public static Speed operator -(Speed right) + { + return new Speed(-right.Value, right.Unit); + } + + public static Speed operator +(Speed left, Speed right) + { + return new Speed(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Speed operator -(Speed left, Speed right) + { + return new Speed(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Speed operator *(double left, Speed right) + { + return new Speed(left * right.Value, right.Unit); + } + + public static Speed operator *(Speed left, double right) + { + return new Speed(left.Value * right, left.Unit); + } + + public static Speed operator /(Speed left, double right) + { + return new Speed(left.Value / right, left.Unit); + } + + public static double operator /(Speed left, Speed right) + { + return left.MetersPerSecond / right.MetersPerSecond; + } + + #endregion + + public static bool operator <=(Speed left, Speed right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Speed left, Speed right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Speed left, Speed right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Speed left, Speed right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Speed left, Speed right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Speed left, Speed right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Temperature.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Temperature.NetFramework.g.cs index bd73cc7821..56391b18e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Temperature.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Temperature.NetFramework.g.cs @@ -59,5 +59,118 @@ public partial struct Temperature : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Temperature from nullable DegreesCelsius. + /// + public static Temperature? FromDegreesCelsius(QuantityValue? degreescelsius) + { + return degreescelsius.HasValue ? FromDegreesCelsius(degreescelsius.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesDelisle. + /// + public static Temperature? FromDegreesDelisle(QuantityValue? degreesdelisle) + { + return degreesdelisle.HasValue ? FromDegreesDelisle(degreesdelisle.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesFahrenheit. + /// + public static Temperature? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) + { + return degreesfahrenheit.HasValue ? FromDegreesFahrenheit(degreesfahrenheit.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesNewton. + /// + public static Temperature? FromDegreesNewton(QuantityValue? degreesnewton) + { + return degreesnewton.HasValue ? FromDegreesNewton(degreesnewton.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesRankine. + /// + public static Temperature? FromDegreesRankine(QuantityValue? degreesrankine) + { + return degreesrankine.HasValue ? FromDegreesRankine(degreesrankine.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesReaumur. + /// + public static Temperature? FromDegreesReaumur(QuantityValue? degreesreaumur) + { + return degreesreaumur.HasValue ? FromDegreesReaumur(degreesreaumur.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable DegreesRoemer. + /// + public static Temperature? FromDegreesRoemer(QuantityValue? degreesroemer) + { + return degreesroemer.HasValue ? FromDegreesRoemer(degreesroemer.Value) : default(Temperature?); + } + + /// + /// Get nullable Temperature from nullable Kelvins. + /// + public static Temperature? FromKelvins(QuantityValue? kelvins) + { + return kelvins.HasValue ? FromKelvins(kelvins.Value) : default(Temperature?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Temperature unit value. + public static Temperature? From(QuantityValue? value, TemperatureUnit fromUnit) + { + return value.HasValue ? new Temperature((double)value.Value, fromUnit) : default(Temperature?); + } + + #endregion + + public static bool operator <=(Temperature left, Temperature right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Temperature left, Temperature right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Temperature left, Temperature right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Temperature left, Temperature right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Temperature left, Temperature right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Temperature left, Temperature right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureChangeRate.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureChangeRate.NetFramework.g.cs index ad6341dbd2..db83c423b3 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureChangeRate.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureChangeRate.NetFramework.g.cs @@ -59,5 +59,173 @@ public partial struct TemperatureChangeRate : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable TemperatureChangeRate from nullable CentidegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromCentidegreesCelsiusPerSecond(QuantityValue? centidegreescelsiuspersecond) + { + return centidegreescelsiuspersecond.HasValue ? FromCentidegreesCelsiusPerSecond(centidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable DecadegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromDecadegreesCelsiusPerSecond(QuantityValue? decadegreescelsiuspersecond) + { + return decadegreescelsiuspersecond.HasValue ? FromDecadegreesCelsiusPerSecond(decadegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable DecidegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromDecidegreesCelsiusPerSecond(QuantityValue? decidegreescelsiuspersecond) + { + return decidegreescelsiuspersecond.HasValue ? FromDecidegreesCelsiusPerSecond(decidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerMinute. + /// + public static TemperatureChangeRate? FromDegreesCelsiusPerMinute(QuantityValue? degreescelsiusperminute) + { + return degreescelsiusperminute.HasValue ? FromDegreesCelsiusPerMinute(degreescelsiusperminute.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromDegreesCelsiusPerSecond(QuantityValue? degreescelsiuspersecond) + { + return degreescelsiuspersecond.HasValue ? FromDegreesCelsiusPerSecond(degreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable HectodegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromHectodegreesCelsiusPerSecond(QuantityValue? hectodegreescelsiuspersecond) + { + return hectodegreescelsiuspersecond.HasValue ? FromHectodegreesCelsiusPerSecond(hectodegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable KilodegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromKilodegreesCelsiusPerSecond(QuantityValue? kilodegreescelsiuspersecond) + { + return kilodegreescelsiuspersecond.HasValue ? FromKilodegreesCelsiusPerSecond(kilodegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable MicrodegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromMicrodegreesCelsiusPerSecond(QuantityValue? microdegreescelsiuspersecond) + { + return microdegreescelsiuspersecond.HasValue ? FromMicrodegreesCelsiusPerSecond(microdegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable MillidegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromMillidegreesCelsiusPerSecond(QuantityValue? millidegreescelsiuspersecond) + { + return millidegreescelsiuspersecond.HasValue ? FromMillidegreesCelsiusPerSecond(millidegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Get nullable TemperatureChangeRate from nullable NanodegreesCelsiusPerSecond. + /// + public static TemperatureChangeRate? FromNanodegreesCelsiusPerSecond(QuantityValue? nanodegreescelsiuspersecond) + { + return nanodegreescelsiuspersecond.HasValue ? FromNanodegreesCelsiusPerSecond(nanodegreescelsiuspersecond.Value) : default(TemperatureChangeRate?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// TemperatureChangeRate unit value. + public static TemperatureChangeRate? From(QuantityValue? value, TemperatureChangeRateUnit fromUnit) + { + return value.HasValue ? new TemperatureChangeRate((double)value.Value, fromUnit) : default(TemperatureChangeRate?); + } + + #endregion + + #region Arithmetic Operators + + public static TemperatureChangeRate operator -(TemperatureChangeRate right) + { + return new TemperatureChangeRate(-right.Value, right.Unit); + } + + public static TemperatureChangeRate operator +(TemperatureChangeRate left, TemperatureChangeRate right) + { + return new TemperatureChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static TemperatureChangeRate operator -(TemperatureChangeRate left, TemperatureChangeRate right) + { + return new TemperatureChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static TemperatureChangeRate operator *(double left, TemperatureChangeRate right) + { + return new TemperatureChangeRate(left * right.Value, right.Unit); + } + + public static TemperatureChangeRate operator *(TemperatureChangeRate left, double right) + { + return new TemperatureChangeRate(left.Value * right, left.Unit); + } + + public static TemperatureChangeRate operator /(TemperatureChangeRate left, double right) + { + return new TemperatureChangeRate(left.Value / right, left.Unit); + } + + public static double operator /(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.DegreesCelsiusPerSecond / right.DegreesCelsiusPerSecond; + } + + #endregion + + public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(TemperatureChangeRate left, TemperatureChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(TemperatureChangeRate left, TemperatureChangeRate right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureDelta.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureDelta.NetFramework.g.cs index 53fa134268..87298119a3 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureDelta.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/TemperatureDelta.NetFramework.g.cs @@ -59,5 +59,221 @@ public partial struct TemperatureDelta : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable TemperatureDelta from nullable DegreesCelsius. + /// + public static TemperatureDelta? FromDegreesCelsius(QuantityValue? degreescelsius) + { + return degreescelsius.HasValue ? FromDegreesCelsius(degreescelsius.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesCelsiusDelta. + /// + public static TemperatureDelta? FromDegreesCelsiusDelta(QuantityValue? degreescelsiusdelta) + { + return degreescelsiusdelta.HasValue ? FromDegreesCelsiusDelta(degreescelsiusdelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesDelisle. + /// + public static TemperatureDelta? FromDegreesDelisle(QuantityValue? degreesdelisle) + { + return degreesdelisle.HasValue ? FromDegreesDelisle(degreesdelisle.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesDelisleDelta. + /// + public static TemperatureDelta? FromDegreesDelisleDelta(QuantityValue? degreesdelisledelta) + { + return degreesdelisledelta.HasValue ? FromDegreesDelisleDelta(degreesdelisledelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesFahrenheit. + /// + public static TemperatureDelta? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) + { + return degreesfahrenheit.HasValue ? FromDegreesFahrenheit(degreesfahrenheit.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesFahrenheitDelta. + /// + public static TemperatureDelta? FromDegreesFahrenheitDelta(QuantityValue? degreesfahrenheitdelta) + { + return degreesfahrenheitdelta.HasValue ? FromDegreesFahrenheitDelta(degreesfahrenheitdelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesNewton. + /// + public static TemperatureDelta? FromDegreesNewton(QuantityValue? degreesnewton) + { + return degreesnewton.HasValue ? FromDegreesNewton(degreesnewton.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesNewtonDelta. + /// + public static TemperatureDelta? FromDegreesNewtonDelta(QuantityValue? degreesnewtondelta) + { + return degreesnewtondelta.HasValue ? FromDegreesNewtonDelta(degreesnewtondelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesRankine. + /// + public static TemperatureDelta? FromDegreesRankine(QuantityValue? degreesrankine) + { + return degreesrankine.HasValue ? FromDegreesRankine(degreesrankine.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesRankineDelta. + /// + public static TemperatureDelta? FromDegreesRankineDelta(QuantityValue? degreesrankinedelta) + { + return degreesrankinedelta.HasValue ? FromDegreesRankineDelta(degreesrankinedelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesReaumur. + /// + public static TemperatureDelta? FromDegreesReaumur(QuantityValue? degreesreaumur) + { + return degreesreaumur.HasValue ? FromDegreesReaumur(degreesreaumur.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesReaumurDelta. + /// + public static TemperatureDelta? FromDegreesReaumurDelta(QuantityValue? degreesreaumurdelta) + { + return degreesreaumurdelta.HasValue ? FromDegreesReaumurDelta(degreesreaumurdelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesRoemer. + /// + public static TemperatureDelta? FromDegreesRoemer(QuantityValue? degreesroemer) + { + return degreesroemer.HasValue ? FromDegreesRoemer(degreesroemer.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable DegreesRoemerDelta. + /// + public static TemperatureDelta? FromDegreesRoemerDelta(QuantityValue? degreesroemerdelta) + { + return degreesroemerdelta.HasValue ? FromDegreesRoemerDelta(degreesroemerdelta.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable Kelvins. + /// + public static TemperatureDelta? FromKelvins(QuantityValue? kelvins) + { + return kelvins.HasValue ? FromKelvins(kelvins.Value) : default(TemperatureDelta?); + } + + /// + /// Get nullable TemperatureDelta from nullable KelvinsDelta. + /// + public static TemperatureDelta? FromKelvinsDelta(QuantityValue? kelvinsdelta) + { + return kelvinsdelta.HasValue ? FromKelvinsDelta(kelvinsdelta.Value) : default(TemperatureDelta?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// TemperatureDelta unit value. + public static TemperatureDelta? From(QuantityValue? value, TemperatureDeltaUnit fromUnit) + { + return value.HasValue ? new TemperatureDelta((double)value.Value, fromUnit) : default(TemperatureDelta?); + } + + #endregion + + #region Arithmetic Operators + + public static TemperatureDelta operator -(TemperatureDelta right) + { + return new TemperatureDelta(-right.Value, right.Unit); + } + + public static TemperatureDelta operator +(TemperatureDelta left, TemperatureDelta right) + { + return new TemperatureDelta(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static TemperatureDelta operator -(TemperatureDelta left, TemperatureDelta right) + { + return new TemperatureDelta(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static TemperatureDelta operator *(double left, TemperatureDelta right) + { + return new TemperatureDelta(left * right.Value, right.Unit); + } + + public static TemperatureDelta operator *(TemperatureDelta left, double right) + { + return new TemperatureDelta(left.Value * right, left.Unit); + } + + public static TemperatureDelta operator /(TemperatureDelta left, double right) + { + return new TemperatureDelta(left.Value / right, left.Unit); + } + + public static double operator /(TemperatureDelta left, TemperatureDelta right) + { + return left.Kelvins / right.Kelvins; + } + + #endregion + + public static bool operator <=(TemperatureDelta left, TemperatureDelta right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(TemperatureDelta left, TemperatureDelta right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(TemperatureDelta left, TemperatureDelta right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(TemperatureDelta left, TemperatureDelta right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(TemperatureDelta left, TemperatureDelta right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(TemperatureDelta left, TemperatureDelta right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalConductivity.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalConductivity.NetFramework.g.cs index ca4361148a..9dfc74331b 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalConductivity.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalConductivity.NetFramework.g.cs @@ -59,5 +59,109 @@ public partial struct ThermalConductivity : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ThermalConductivity from nullable BtusPerHourFootFahrenheit. + /// + public static ThermalConductivity? FromBtusPerHourFootFahrenheit(QuantityValue? btusperhourfootfahrenheit) + { + return btusperhourfootfahrenheit.HasValue ? FromBtusPerHourFootFahrenheit(btusperhourfootfahrenheit.Value) : default(ThermalConductivity?); + } + + /// + /// Get nullable ThermalConductivity from nullable WattsPerMeterKelvin. + /// + public static ThermalConductivity? FromWattsPerMeterKelvin(QuantityValue? wattspermeterkelvin) + { + return wattspermeterkelvin.HasValue ? FromWattsPerMeterKelvin(wattspermeterkelvin.Value) : default(ThermalConductivity?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ThermalConductivity unit value. + public static ThermalConductivity? From(QuantityValue? value, ThermalConductivityUnit fromUnit) + { + return value.HasValue ? new ThermalConductivity((double)value.Value, fromUnit) : default(ThermalConductivity?); + } + + #endregion + + #region Arithmetic Operators + + public static ThermalConductivity operator -(ThermalConductivity right) + { + return new ThermalConductivity(-right.Value, right.Unit); + } + + public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right) + { + return new ThermalConductivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right) + { + return new ThermalConductivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ThermalConductivity operator *(double left, ThermalConductivity right) + { + return new ThermalConductivity(left * right.Value, right.Unit); + } + + public static ThermalConductivity operator *(ThermalConductivity left, double right) + { + return new ThermalConductivity(left.Value * right, left.Unit); + } + + public static ThermalConductivity operator /(ThermalConductivity left, double right) + { + return new ThermalConductivity(left.Value / right, left.Unit); + } + + public static double operator /(ThermalConductivity left, ThermalConductivity right) + { + return left.WattsPerMeterKelvin / right.WattsPerMeterKelvin; + } + + #endregion + + public static bool operator <=(ThermalConductivity left, ThermalConductivity right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ThermalConductivity left, ThermalConductivity right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ThermalConductivity left, ThermalConductivity right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ThermalConductivity left, ThermalConductivity right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ThermalConductivity left, ThermalConductivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ThermalConductivity left, ThermalConductivity right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalResistance.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalResistance.NetFramework.g.cs index 4496923a81..eddb48fe99 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalResistance.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/ThermalResistance.NetFramework.g.cs @@ -59,5 +59,133 @@ public partial struct ThermalResistance : IComparable, IComparable public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable ThermalResistance from nullable HourSquareFeetDegreesFahrenheitPerBtu. + /// + public static ThermalResistance? FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue? hoursquarefeetdegreesfahrenheitperbtu) + { + return hoursquarefeetdegreesfahrenheitperbtu.HasValue ? FromHourSquareFeetDegreesFahrenheitPerBtu(hoursquarefeetdegreesfahrenheitperbtu.Value) : default(ThermalResistance?); + } + + /// + /// Get nullable ThermalResistance from nullable SquareCentimeterHourDegreesCelsiusPerKilocalorie. + /// + public static ThermalResistance? FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue? squarecentimeterhourdegreescelsiusperkilocalorie) + { + return squarecentimeterhourdegreescelsiusperkilocalorie.HasValue ? FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squarecentimeterhourdegreescelsiusperkilocalorie.Value) : default(ThermalResistance?); + } + + /// + /// Get nullable ThermalResistance from nullable SquareCentimeterKelvinsPerWatt. + /// + public static ThermalResistance? FromSquareCentimeterKelvinsPerWatt(QuantityValue? squarecentimeterkelvinsperwatt) + { + return squarecentimeterkelvinsperwatt.HasValue ? FromSquareCentimeterKelvinsPerWatt(squarecentimeterkelvinsperwatt.Value) : default(ThermalResistance?); + } + + /// + /// Get nullable ThermalResistance from nullable SquareMeterDegreesCelsiusPerWatt. + /// + public static ThermalResistance? FromSquareMeterDegreesCelsiusPerWatt(QuantityValue? squaremeterdegreescelsiusperwatt) + { + return squaremeterdegreescelsiusperwatt.HasValue ? FromSquareMeterDegreesCelsiusPerWatt(squaremeterdegreescelsiusperwatt.Value) : default(ThermalResistance?); + } + + /// + /// Get nullable ThermalResistance from nullable SquareMeterKelvinsPerKilowatt. + /// + public static ThermalResistance? FromSquareMeterKelvinsPerKilowatt(QuantityValue? squaremeterkelvinsperkilowatt) + { + return squaremeterkelvinsperkilowatt.HasValue ? FromSquareMeterKelvinsPerKilowatt(squaremeterkelvinsperkilowatt.Value) : default(ThermalResistance?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// ThermalResistance unit value. + public static ThermalResistance? From(QuantityValue? value, ThermalResistanceUnit fromUnit) + { + return value.HasValue ? new ThermalResistance((double)value.Value, fromUnit) : default(ThermalResistance?); + } + + #endregion + + #region Arithmetic Operators + + public static ThermalResistance operator -(ThermalResistance right) + { + return new ThermalResistance(-right.Value, right.Unit); + } + + public static ThermalResistance operator +(ThermalResistance left, ThermalResistance right) + { + return new ThermalResistance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ThermalResistance operator -(ThermalResistance left, ThermalResistance right) + { + return new ThermalResistance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static ThermalResistance operator *(double left, ThermalResistance right) + { + return new ThermalResistance(left * right.Value, right.Unit); + } + + public static ThermalResistance operator *(ThermalResistance left, double right) + { + return new ThermalResistance(left.Value * right, left.Unit); + } + + public static ThermalResistance operator /(ThermalResistance left, double right) + { + return new ThermalResistance(left.Value / right, left.Unit); + } + + public static double operator /(ThermalResistance left, ThermalResistance right) + { + return left.SquareMeterKelvinsPerKilowatt / right.SquareMeterKelvinsPerKilowatt; + } + + #endregion + + public static bool operator <=(ThermalResistance left, ThermalResistance right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(ThermalResistance left, ThermalResistance right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(ThermalResistance left, ThermalResistance right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(ThermalResistance left, ThermalResistance right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(ThermalResistance left, ThermalResistance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(ThermalResistance left, ThermalResistance right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Torque.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Torque.NetFramework.g.cs index 9b0163c15c..84622f9eb5 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Torque.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Torque.NetFramework.g.cs @@ -59,5 +59,261 @@ public partial struct Torque : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Torque from nullable KilogramForceCentimeters. + /// + public static Torque? FromKilogramForceCentimeters(QuantityValue? kilogramforcecentimeters) + { + return kilogramforcecentimeters.HasValue ? FromKilogramForceCentimeters(kilogramforcecentimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilogramForceMeters. + /// + public static Torque? FromKilogramForceMeters(QuantityValue? kilogramforcemeters) + { + return kilogramforcemeters.HasValue ? FromKilogramForceMeters(kilogramforcemeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilogramForceMillimeters. + /// + public static Torque? FromKilogramForceMillimeters(QuantityValue? kilogramforcemillimeters) + { + return kilogramforcemillimeters.HasValue ? FromKilogramForceMillimeters(kilogramforcemillimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilonewtonCentimeters. + /// + public static Torque? FromKilonewtonCentimeters(QuantityValue? kilonewtoncentimeters) + { + return kilonewtoncentimeters.HasValue ? FromKilonewtonCentimeters(kilonewtoncentimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilonewtonMeters. + /// + public static Torque? FromKilonewtonMeters(QuantityValue? kilonewtonmeters) + { + return kilonewtonmeters.HasValue ? FromKilonewtonMeters(kilonewtonmeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilonewtonMillimeters. + /// + public static Torque? FromKilonewtonMillimeters(QuantityValue? kilonewtonmillimeters) + { + return kilonewtonmillimeters.HasValue ? FromKilonewtonMillimeters(kilonewtonmillimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilopoundForceFeet. + /// + public static Torque? FromKilopoundForceFeet(QuantityValue? kilopoundforcefeet) + { + return kilopoundforcefeet.HasValue ? FromKilopoundForceFeet(kilopoundforcefeet.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable KilopoundForceInches. + /// + public static Torque? FromKilopoundForceInches(QuantityValue? kilopoundforceinches) + { + return kilopoundforceinches.HasValue ? FromKilopoundForceInches(kilopoundforceinches.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable MeganewtonCentimeters. + /// + public static Torque? FromMeganewtonCentimeters(QuantityValue? meganewtoncentimeters) + { + return meganewtoncentimeters.HasValue ? FromMeganewtonCentimeters(meganewtoncentimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable MeganewtonMeters. + /// + public static Torque? FromMeganewtonMeters(QuantityValue? meganewtonmeters) + { + return meganewtonmeters.HasValue ? FromMeganewtonMeters(meganewtonmeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable MeganewtonMillimeters. + /// + public static Torque? FromMeganewtonMillimeters(QuantityValue? meganewtonmillimeters) + { + return meganewtonmillimeters.HasValue ? FromMeganewtonMillimeters(meganewtonmillimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable MegapoundForceFeet. + /// + public static Torque? FromMegapoundForceFeet(QuantityValue? megapoundforcefeet) + { + return megapoundforcefeet.HasValue ? FromMegapoundForceFeet(megapoundforcefeet.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable MegapoundForceInches. + /// + public static Torque? FromMegapoundForceInches(QuantityValue? megapoundforceinches) + { + return megapoundforceinches.HasValue ? FromMegapoundForceInches(megapoundforceinches.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable NewtonCentimeters. + /// + public static Torque? FromNewtonCentimeters(QuantityValue? newtoncentimeters) + { + return newtoncentimeters.HasValue ? FromNewtonCentimeters(newtoncentimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable NewtonMeters. + /// + public static Torque? FromNewtonMeters(QuantityValue? newtonmeters) + { + return newtonmeters.HasValue ? FromNewtonMeters(newtonmeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable NewtonMillimeters. + /// + public static Torque? FromNewtonMillimeters(QuantityValue? newtonmillimeters) + { + return newtonmillimeters.HasValue ? FromNewtonMillimeters(newtonmillimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable PoundForceFeet. + /// + public static Torque? FromPoundForceFeet(QuantityValue? poundforcefeet) + { + return poundforcefeet.HasValue ? FromPoundForceFeet(poundforcefeet.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable PoundForceInches. + /// + public static Torque? FromPoundForceInches(QuantityValue? poundforceinches) + { + return poundforceinches.HasValue ? FromPoundForceInches(poundforceinches.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable TonneForceCentimeters. + /// + public static Torque? FromTonneForceCentimeters(QuantityValue? tonneforcecentimeters) + { + return tonneforcecentimeters.HasValue ? FromTonneForceCentimeters(tonneforcecentimeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable TonneForceMeters. + /// + public static Torque? FromTonneForceMeters(QuantityValue? tonneforcemeters) + { + return tonneforcemeters.HasValue ? FromTonneForceMeters(tonneforcemeters.Value) : default(Torque?); + } + + /// + /// Get nullable Torque from nullable TonneForceMillimeters. + /// + public static Torque? FromTonneForceMillimeters(QuantityValue? tonneforcemillimeters) + { + return tonneforcemillimeters.HasValue ? FromTonneForceMillimeters(tonneforcemillimeters.Value) : default(Torque?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Torque unit value. + public static Torque? From(QuantityValue? value, TorqueUnit fromUnit) + { + return value.HasValue ? new Torque((double)value.Value, fromUnit) : default(Torque?); + } + + #endregion + + #region Arithmetic Operators + + public static Torque operator -(Torque right) + { + return new Torque(-right.Value, right.Unit); + } + + public static Torque operator +(Torque left, Torque right) + { + return new Torque(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Torque operator -(Torque left, Torque right) + { + return new Torque(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Torque operator *(double left, Torque right) + { + return new Torque(left * right.Value, right.Unit); + } + + public static Torque operator *(Torque left, double right) + { + return new Torque(left.Value * right, left.Unit); + } + + public static Torque operator /(Torque left, double right) + { + return new Torque(left.Value / right, left.Unit); + } + + public static double operator /(Torque left, Torque right) + { + return left.NewtonMeters / right.NewtonMeters; + } + + #endregion + + public static bool operator <=(Torque left, Torque right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Torque left, Torque right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Torque left, Torque right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Torque left, Torque right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Torque left, Torque right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Torque left, Torque right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/VitaminA.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/VitaminA.NetFramework.g.cs index 0d881583cc..2b7d5df02b 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/VitaminA.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/VitaminA.NetFramework.g.cs @@ -59,5 +59,101 @@ public partial struct VitaminA : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable VitaminA from nullable InternationalUnits. + /// + public static VitaminA? FromInternationalUnits(QuantityValue? internationalunits) + { + return internationalunits.HasValue ? FromInternationalUnits(internationalunits.Value) : default(VitaminA?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VitaminA unit value. + public static VitaminA? From(QuantityValue? value, VitaminAUnit fromUnit) + { + return value.HasValue ? new VitaminA((double)value.Value, fromUnit) : default(VitaminA?); + } + + #endregion + + #region Arithmetic Operators + + public static VitaminA operator -(VitaminA right) + { + return new VitaminA(-right.Value, right.Unit); + } + + public static VitaminA operator +(VitaminA left, VitaminA right) + { + return new VitaminA(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static VitaminA operator -(VitaminA left, VitaminA right) + { + return new VitaminA(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static VitaminA operator *(double left, VitaminA right) + { + return new VitaminA(left * right.Value, right.Unit); + } + + public static VitaminA operator *(VitaminA left, double right) + { + return new VitaminA(left.Value * right, left.Unit); + } + + public static VitaminA operator /(VitaminA left, double right) + { + return new VitaminA(left.Value / right, left.Unit); + } + + public static double operator /(VitaminA left, VitaminA right) + { + return left.InternationalUnits / right.InternationalUnits; + } + + #endregion + + public static bool operator <=(VitaminA left, VitaminA right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(VitaminA left, VitaminA right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(VitaminA left, VitaminA right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(VitaminA left, VitaminA right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(VitaminA left, VitaminA right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(VitaminA left, VitaminA right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/Volume.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/Volume.NetFramework.g.cs index 0a13d5d21b..d931df94fd 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/Volume.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/Volume.NetFramework.g.cs @@ -59,5 +59,445 @@ public partial struct Volume : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable Volume from nullable AuTablespoons. + /// + public static Volume? FromAuTablespoons(QuantityValue? autablespoons) + { + return autablespoons.HasValue ? FromAuTablespoons(autablespoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Centiliters. + /// + public static Volume? FromCentiliters(QuantityValue? centiliters) + { + return centiliters.HasValue ? FromCentiliters(centiliters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicCentimeters. + /// + public static Volume? FromCubicCentimeters(QuantityValue? cubiccentimeters) + { + return cubiccentimeters.HasValue ? FromCubicCentimeters(cubiccentimeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicDecimeters. + /// + public static Volume? FromCubicDecimeters(QuantityValue? cubicdecimeters) + { + return cubicdecimeters.HasValue ? FromCubicDecimeters(cubicdecimeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicFeet. + /// + public static Volume? FromCubicFeet(QuantityValue? cubicfeet) + { + return cubicfeet.HasValue ? FromCubicFeet(cubicfeet.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicInches. + /// + public static Volume? FromCubicInches(QuantityValue? cubicinches) + { + return cubicinches.HasValue ? FromCubicInches(cubicinches.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicKilometers. + /// + public static Volume? FromCubicKilometers(QuantityValue? cubickilometers) + { + return cubickilometers.HasValue ? FromCubicKilometers(cubickilometers.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicMeters. + /// + public static Volume? FromCubicMeters(QuantityValue? cubicmeters) + { + return cubicmeters.HasValue ? FromCubicMeters(cubicmeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicMicrometers. + /// + public static Volume? FromCubicMicrometers(QuantityValue? cubicmicrometers) + { + return cubicmicrometers.HasValue ? FromCubicMicrometers(cubicmicrometers.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicMiles. + /// + public static Volume? FromCubicMiles(QuantityValue? cubicmiles) + { + return cubicmiles.HasValue ? FromCubicMiles(cubicmiles.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicMillimeters. + /// + public static Volume? FromCubicMillimeters(QuantityValue? cubicmillimeters) + { + return cubicmillimeters.HasValue ? FromCubicMillimeters(cubicmillimeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable CubicYards. + /// + public static Volume? FromCubicYards(QuantityValue? cubicyards) + { + return cubicyards.HasValue ? FromCubicYards(cubicyards.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Deciliters. + /// + public static Volume? FromDeciliters(QuantityValue? deciliters) + { + return deciliters.HasValue ? FromDeciliters(deciliters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable HectocubicFeet. + /// + public static Volume? FromHectocubicFeet(QuantityValue? hectocubicfeet) + { + return hectocubicfeet.HasValue ? FromHectocubicFeet(hectocubicfeet.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable HectocubicMeters. + /// + public static Volume? FromHectocubicMeters(QuantityValue? hectocubicmeters) + { + return hectocubicmeters.HasValue ? FromHectocubicMeters(hectocubicmeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Hectoliters. + /// + public static Volume? FromHectoliters(QuantityValue? hectoliters) + { + return hectoliters.HasValue ? FromHectoliters(hectoliters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable ImperialBeerBarrels. + /// + public static Volume? FromImperialBeerBarrels(QuantityValue? imperialbeerbarrels) + { + return imperialbeerbarrels.HasValue ? FromImperialBeerBarrels(imperialbeerbarrels.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable ImperialGallons. + /// + public static Volume? FromImperialGallons(QuantityValue? imperialgallons) + { + return imperialgallons.HasValue ? FromImperialGallons(imperialgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable ImperialOunces. + /// + public static Volume? FromImperialOunces(QuantityValue? imperialounces) + { + return imperialounces.HasValue ? FromImperialOunces(imperialounces.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable KilocubicFeet. + /// + public static Volume? FromKilocubicFeet(QuantityValue? kilocubicfeet) + { + return kilocubicfeet.HasValue ? FromKilocubicFeet(kilocubicfeet.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable KilocubicMeters. + /// + public static Volume? FromKilocubicMeters(QuantityValue? kilocubicmeters) + { + return kilocubicmeters.HasValue ? FromKilocubicMeters(kilocubicmeters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable KiloimperialGallons. + /// + public static Volume? FromKiloimperialGallons(QuantityValue? kiloimperialgallons) + { + return kiloimperialgallons.HasValue ? FromKiloimperialGallons(kiloimperialgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable KilousGallons. + /// + public static Volume? FromKilousGallons(QuantityValue? kilousgallons) + { + return kilousgallons.HasValue ? FromKilousGallons(kilousgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Liters. + /// + public static Volume? FromLiters(QuantityValue? liters) + { + return liters.HasValue ? FromLiters(liters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable MegacubicFeet. + /// + public static Volume? FromMegacubicFeet(QuantityValue? megacubicfeet) + { + return megacubicfeet.HasValue ? FromMegacubicFeet(megacubicfeet.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable MegaimperialGallons. + /// + public static Volume? FromMegaimperialGallons(QuantityValue? megaimperialgallons) + { + return megaimperialgallons.HasValue ? FromMegaimperialGallons(megaimperialgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable MegausGallons. + /// + public static Volume? FromMegausGallons(QuantityValue? megausgallons) + { + return megausgallons.HasValue ? FromMegausGallons(megausgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable MetricCups. + /// + public static Volume? FromMetricCups(QuantityValue? metriccups) + { + return metriccups.HasValue ? FromMetricCups(metriccups.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable MetricTeaspoons. + /// + public static Volume? FromMetricTeaspoons(QuantityValue? metricteaspoons) + { + return metricteaspoons.HasValue ? FromMetricTeaspoons(metricteaspoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Microliters. + /// + public static Volume? FromMicroliters(QuantityValue? microliters) + { + return microliters.HasValue ? FromMicroliters(microliters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Milliliters. + /// + public static Volume? FromMilliliters(QuantityValue? milliliters) + { + return milliliters.HasValue ? FromMilliliters(milliliters.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable OilBarrels. + /// + public static Volume? FromOilBarrels(QuantityValue? oilbarrels) + { + return oilbarrels.HasValue ? FromOilBarrels(oilbarrels.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Tablespoons. + /// + public static Volume? FromTablespoons(QuantityValue? tablespoons) + { + return tablespoons.HasValue ? FromTablespoons(tablespoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable Teaspoons. + /// + public static Volume? FromTeaspoons(QuantityValue? teaspoons) + { + return teaspoons.HasValue ? FromTeaspoons(teaspoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UkTablespoons. + /// + public static Volume? FromUkTablespoons(QuantityValue? uktablespoons) + { + return uktablespoons.HasValue ? FromUkTablespoons(uktablespoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsBeerBarrels. + /// + public static Volume? FromUsBeerBarrels(QuantityValue? usbeerbarrels) + { + return usbeerbarrels.HasValue ? FromUsBeerBarrels(usbeerbarrels.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsCustomaryCups. + /// + public static Volume? FromUsCustomaryCups(QuantityValue? uscustomarycups) + { + return uscustomarycups.HasValue ? FromUsCustomaryCups(uscustomarycups.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsGallons. + /// + public static Volume? FromUsGallons(QuantityValue? usgallons) + { + return usgallons.HasValue ? FromUsGallons(usgallons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsLegalCups. + /// + public static Volume? FromUsLegalCups(QuantityValue? uslegalcups) + { + return uslegalcups.HasValue ? FromUsLegalCups(uslegalcups.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsOunces. + /// + public static Volume? FromUsOunces(QuantityValue? usounces) + { + return usounces.HasValue ? FromUsOunces(usounces.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsPints. + /// + public static Volume? FromUsPints(QuantityValue? uspints) + { + return uspints.HasValue ? FromUsPints(uspints.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsQuarts. + /// + public static Volume? FromUsQuarts(QuantityValue? usquarts) + { + return usquarts.HasValue ? FromUsQuarts(usquarts.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsTablespoons. + /// + public static Volume? FromUsTablespoons(QuantityValue? ustablespoons) + { + return ustablespoons.HasValue ? FromUsTablespoons(ustablespoons.Value) : default(Volume?); + } + + /// + /// Get nullable Volume from nullable UsTeaspoons. + /// + public static Volume? FromUsTeaspoons(QuantityValue? usteaspoons) + { + return usteaspoons.HasValue ? FromUsTeaspoons(usteaspoons.Value) : default(Volume?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// Volume unit value. + public static Volume? From(QuantityValue? value, VolumeUnit fromUnit) + { + return value.HasValue ? new Volume((double)value.Value, fromUnit) : default(Volume?); + } + + #endregion + + #region Arithmetic Operators + + public static Volume operator -(Volume right) + { + return new Volume(-right.Value, right.Unit); + } + + public static Volume operator +(Volume left, Volume right) + { + return new Volume(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Volume operator -(Volume left, Volume right) + { + return new Volume(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static Volume operator *(double left, Volume right) + { + return new Volume(left * right.Value, right.Unit); + } + + public static Volume operator *(Volume left, double right) + { + return new Volume(left.Value * right, left.Unit); + } + + public static Volume operator /(Volume left, double right) + { + return new Volume(left.Value / right, left.Unit); + } + + public static double operator /(Volume left, Volume right) + { + return left.CubicMeters / right.CubicMeters; + } + + #endregion + + public static bool operator <=(Volume left, Volume right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(Volume left, Volume right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(Volume left, Volume right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(Volume left, Volume right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(Volume left, Volume right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(Volume left, Volume right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/NetFramework/VolumeFlow.NetFramework.g.cs b/UnitsNet/GeneratedCode/Quantities/NetFramework/VolumeFlow.NetFramework.g.cs index 7150ec34dc..e4ce66f9b8 100644 --- a/UnitsNet/GeneratedCode/Quantities/NetFramework/VolumeFlow.NetFramework.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/NetFramework/VolumeFlow.NetFramework.g.cs @@ -59,5 +59,285 @@ public partial struct VolumeFlow : IComparable, IComparable /// The numeric value this quantity was constructed with. ///
public double Value => _value; + + #region Nullable From Methods + + /// + /// Get nullable VolumeFlow from nullable CentilitersPerMinute. + /// + public static VolumeFlow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) + { + return centilitersperminute.HasValue ? FromCentilitersPerMinute(centilitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicDecimetersPerMinute. + /// + public static VolumeFlow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) + { + return cubicdecimetersperminute.HasValue ? FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicFeetPerHour. + /// + public static VolumeFlow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) + { + return cubicfeetperhour.HasValue ? FromCubicFeetPerHour(cubicfeetperhour.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicFeetPerMinute. + /// + public static VolumeFlow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) + { + return cubicfeetperminute.HasValue ? FromCubicFeetPerMinute(cubicfeetperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicFeetPerSecond. + /// + public static VolumeFlow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) + { + return cubicfeetpersecond.HasValue ? FromCubicFeetPerSecond(cubicfeetpersecond.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicMetersPerHour. + /// + public static VolumeFlow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) + { + return cubicmetersperhour.HasValue ? FromCubicMetersPerHour(cubicmetersperhour.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicMetersPerMinute. + /// + public static VolumeFlow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) + { + return cubicmetersperminute.HasValue ? FromCubicMetersPerMinute(cubicmetersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicMetersPerSecond. + /// + public static VolumeFlow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) + { + return cubicmeterspersecond.HasValue ? FromCubicMetersPerSecond(cubicmeterspersecond.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicYardsPerHour. + /// + public static VolumeFlow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) + { + return cubicyardsperhour.HasValue ? FromCubicYardsPerHour(cubicyardsperhour.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicYardsPerMinute. + /// + public static VolumeFlow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) + { + return cubicyardsperminute.HasValue ? FromCubicYardsPerMinute(cubicyardsperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable CubicYardsPerSecond. + /// + public static VolumeFlow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) + { + return cubicyardspersecond.HasValue ? FromCubicYardsPerSecond(cubicyardspersecond.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable DecilitersPerMinute. + /// + public static VolumeFlow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) + { + return decilitersperminute.HasValue ? FromDecilitersPerMinute(decilitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable KilolitersPerMinute. + /// + public static VolumeFlow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) + { + return kilolitersperminute.HasValue ? FromKilolitersPerMinute(kilolitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable LitersPerHour. + /// + public static VolumeFlow? FromLitersPerHour(QuantityValue? litersperhour) + { + return litersperhour.HasValue ? FromLitersPerHour(litersperhour.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable LitersPerMinute. + /// + public static VolumeFlow? FromLitersPerMinute(QuantityValue? litersperminute) + { + return litersperminute.HasValue ? FromLitersPerMinute(litersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable LitersPerSecond. + /// + public static VolumeFlow? FromLitersPerSecond(QuantityValue? literspersecond) + { + return literspersecond.HasValue ? FromLitersPerSecond(literspersecond.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable MicrolitersPerMinute. + /// + public static VolumeFlow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) + { + return microlitersperminute.HasValue ? FromMicrolitersPerMinute(microlitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable MillilitersPerMinute. + /// + public static VolumeFlow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) + { + return millilitersperminute.HasValue ? FromMillilitersPerMinute(millilitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable MillionUsGallonsPerDay. + /// + public static VolumeFlow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) + { + return millionusgallonsperday.HasValue ? FromMillionUsGallonsPerDay(millionusgallonsperday.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable NanolitersPerMinute. + /// + public static VolumeFlow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) + { + return nanolitersperminute.HasValue ? FromNanolitersPerMinute(nanolitersperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable OilBarrelsPerDay. + /// + public static VolumeFlow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) + { + return oilbarrelsperday.HasValue ? FromOilBarrelsPerDay(oilbarrelsperday.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable UsGallonsPerHour. + /// + public static VolumeFlow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) + { + return usgallonsperhour.HasValue ? FromUsGallonsPerHour(usgallonsperhour.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable UsGallonsPerMinute. + /// + public static VolumeFlow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) + { + return usgallonsperminute.HasValue ? FromUsGallonsPerMinute(usgallonsperminute.Value) : default(VolumeFlow?); + } + + /// + /// Get nullable VolumeFlow from nullable UsGallonsPerSecond. + /// + public static VolumeFlow? FromUsGallonsPerSecond(QuantityValue? usgallonspersecond) + { + return usgallonspersecond.HasValue ? FromUsGallonsPerSecond(usgallonspersecond.Value) : default(VolumeFlow?); + } + + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// VolumeFlow unit value. + public static VolumeFlow? From(QuantityValue? value, VolumeFlowUnit fromUnit) + { + return value.HasValue ? new VolumeFlow((double)value.Value, fromUnit) : default(VolumeFlow?); + } + + #endregion + + #region Arithmetic Operators + + public static VolumeFlow operator -(VolumeFlow right) + { + return new VolumeFlow(-right.Value, right.Unit); + } + + public static VolumeFlow operator +(VolumeFlow left, VolumeFlow right) + { + return new VolumeFlow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static VolumeFlow operator -(VolumeFlow left, VolumeFlow right) + { + return new VolumeFlow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static VolumeFlow operator *(double left, VolumeFlow right) + { + return new VolumeFlow(left * right.Value, right.Unit); + } + + public static VolumeFlow operator *(VolumeFlow left, double right) + { + return new VolumeFlow(left.Value * right, left.Unit); + } + + public static VolumeFlow operator /(VolumeFlow left, double right) + { + return new VolumeFlow(left.Value / right, left.Unit); + } + + public static double operator /(VolumeFlow left, VolumeFlow right) + { + return left.CubicMetersPerSecond / right.CubicMetersPerSecond; + } + + #endregion + + public static bool operator <=(VolumeFlow left, VolumeFlow right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=(VolumeFlow left, VolumeFlow right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <(VolumeFlow left, VolumeFlow right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >(VolumeFlow left, VolumeFlow right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator ==(VolumeFlow left, VolumeFlow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals(other, maxError) to provide the max allowed error.")] + public static bool operator !=(VolumeFlow left, VolumeFlow right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } diff --git a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs index ba301a33cd..eb0383b5d2 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permeability.g.cs @@ -179,24 +179,6 @@ public static Permeability FromHenriesPerMeter(QuantityValue henriespermeter) return new Permeability(value, PermeabilityUnit.HenryPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Permeability from nullable HenriesPerMeter. - /// - public static Permeability? FromHenriesPerMeter(QuantityValue? henriespermeter) - { - if (henriespermeter.HasValue) - { - return FromHenriesPerMeter(henriespermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static Permeability From(QuantityValue value, PermeabilityUnit fromUnit) return new Permeability((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Permeability unit value. - public static Permeability? From(QuantityValue? value, PermeabilityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Permeability((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Permeability operator -(Permeability right) - { - return new Permeability(-right.Value, right.Unit); - } - - public static Permeability operator +(Permeability left, Permeability right) - { - return new Permeability(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Permeability operator -(Permeability left, Permeability right) - { - return new Permeability(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Permeability operator *(double left, Permeability right) - { - return new Permeability(left * right.Value, right.Unit); - } - - public static Permeability operator *(Permeability left, double right) - { - return new Permeability(left.Value * right, left.Unit); - } - - public static Permeability operator /(Permeability left, double right) - { - return new Permeability(left.Value / right, left.Unit); - } - - public static double operator /(Permeability left, Permeability right) - { - return left.HenriesPerMeter / right.HenriesPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(Permeability other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Permeability left, Permeability right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Permeability left, Permeability right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Permeability left, Permeability right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Permeability left, Permeability right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Permeability left, Permeability right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Permeability left, Permeability right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs index 20e0298b76..67bdb58abc 100644 --- a/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Permittivity.g.cs @@ -179,24 +179,6 @@ public static Permittivity FromFaradsPerMeter(QuantityValue faradspermeter) return new Permittivity(value, PermittivityUnit.FaradPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Permittivity from nullable FaradsPerMeter. - /// - public static Permittivity? FromFaradsPerMeter(QuantityValue? faradspermeter) - { - if (faradspermeter.HasValue) - { - return FromFaradsPerMeter(faradspermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static Permittivity From(QuantityValue value, PermittivityUnit fromUnit) return new Permittivity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Permittivity unit value. - public static Permittivity? From(QuantityValue? value, PermittivityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Permittivity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Permittivity operator -(Permittivity right) - { - return new Permittivity(-right.Value, right.Unit); - } - - public static Permittivity operator +(Permittivity left, Permittivity right) - { - return new Permittivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Permittivity operator -(Permittivity left, Permittivity right) - { - return new Permittivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Permittivity operator *(double left, Permittivity right) - { - return new Permittivity(left * right.Value, right.Unit); - } - - public static Permittivity operator *(Permittivity left, double right) - { - return new Permittivity(left.Value * right, left.Unit); - } - - public static Permittivity operator /(Permittivity left, double right) - { - return new Permittivity(left.Value / right, left.Unit); - } - - public static double operator /(Permittivity left, Permittivity right) - { - return left.FaradsPerMeter / right.FaradsPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(Permittivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Permittivity left, Permittivity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Permittivity left, Permittivity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Permittivity left, Permittivity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Permittivity left, Permittivity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Permittivity left, Permittivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Permittivity left, Permittivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs index 93dfd3bbe1..e69ce8af8d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs @@ -521,309 +521,6 @@ public static Power FromWatts(QuantityValue watts) return new Power(value, PowerUnit.Watt); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Power from nullable BoilerHorsepower. - /// - public static Power? FromBoilerHorsepower(QuantityValue? boilerhorsepower) - { - if (boilerhorsepower.HasValue) - { - return FromBoilerHorsepower(boilerhorsepower.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable BritishThermalUnitsPerHour. - /// - public static Power? FromBritishThermalUnitsPerHour(QuantityValue? britishthermalunitsperhour) - { - if (britishthermalunitsperhour.HasValue) - { - return FromBritishThermalUnitsPerHour(britishthermalunitsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Decawatts. - /// - public static Power? FromDecawatts(QuantityValue? decawatts) - { - if (decawatts.HasValue) - { - return FromDecawatts(decawatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Deciwatts. - /// - public static Power? FromDeciwatts(QuantityValue? deciwatts) - { - if (deciwatts.HasValue) - { - return FromDeciwatts(deciwatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable ElectricalHorsepower. - /// - public static Power? FromElectricalHorsepower(QuantityValue? electricalhorsepower) - { - if (electricalhorsepower.HasValue) - { - return FromElectricalHorsepower(electricalhorsepower.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Femtowatts. - /// - public static Power? FromFemtowatts(QuantityValue? femtowatts) - { - if (femtowatts.HasValue) - { - return FromFemtowatts(femtowatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Gigawatts. - /// - public static Power? FromGigawatts(QuantityValue? gigawatts) - { - if (gigawatts.HasValue) - { - return FromGigawatts(gigawatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable HydraulicHorsepower. - /// - public static Power? FromHydraulicHorsepower(QuantityValue? hydraulichorsepower) - { - if (hydraulichorsepower.HasValue) - { - return FromHydraulicHorsepower(hydraulichorsepower.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable KilobritishThermalUnitsPerHour. - /// - public static Power? FromKilobritishThermalUnitsPerHour(QuantityValue? kilobritishthermalunitsperhour) - { - if (kilobritishthermalunitsperhour.HasValue) - { - return FromKilobritishThermalUnitsPerHour(kilobritishthermalunitsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Kilowatts. - /// - public static Power? FromKilowatts(QuantityValue? kilowatts) - { - if (kilowatts.HasValue) - { - return FromKilowatts(kilowatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable MechanicalHorsepower. - /// - public static Power? FromMechanicalHorsepower(QuantityValue? mechanicalhorsepower) - { - if (mechanicalhorsepower.HasValue) - { - return FromMechanicalHorsepower(mechanicalhorsepower.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Megawatts. - /// - public static Power? FromMegawatts(QuantityValue? megawatts) - { - if (megawatts.HasValue) - { - return FromMegawatts(megawatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable MetricHorsepower. - /// - public static Power? FromMetricHorsepower(QuantityValue? metrichorsepower) - { - if (metrichorsepower.HasValue) - { - return FromMetricHorsepower(metrichorsepower.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Microwatts. - /// - public static Power? FromMicrowatts(QuantityValue? microwatts) - { - if (microwatts.HasValue) - { - return FromMicrowatts(microwatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Milliwatts. - /// - public static Power? FromMilliwatts(QuantityValue? milliwatts) - { - if (milliwatts.HasValue) - { - return FromMilliwatts(milliwatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Nanowatts. - /// - public static Power? FromNanowatts(QuantityValue? nanowatts) - { - if (nanowatts.HasValue) - { - return FromNanowatts(nanowatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Petawatts. - /// - public static Power? FromPetawatts(QuantityValue? petawatts) - { - if (petawatts.HasValue) - { - return FromPetawatts(petawatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Picowatts. - /// - public static Power? FromPicowatts(QuantityValue? picowatts) - { - if (picowatts.HasValue) - { - return FromPicowatts(picowatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Terawatts. - /// - public static Power? FromTerawatts(QuantityValue? terawatts) - { - if (terawatts.HasValue) - { - return FromTerawatts(terawatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Power from nullable Watts. - /// - public static Power? FromWatts(QuantityValue? watts) - { - if (watts.HasValue) - { - return FromWatts(watts.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -842,25 +539,6 @@ public static Power From(QuantityValue value, PowerUnit fromUnit) return new Power((decimal)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Power unit value. - public static Power? From(QuantityValue? value, PowerUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Power((decimal)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -903,48 +581,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Power operator -(Power right) - { - return new Power(-right.Value, right.Unit); - } - - public static Power operator +(Power left, Power right) - { - return new Power(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Power operator -(Power left, Power right) - { - return new Power(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Power operator *(decimal left, Power right) - { - return new Power(left * right.Value, right.Unit); - } - - public static Power operator *(Power left, decimal right) - { - return new Power(left.Value * right, left.Unit); - } - - public static Power operator /(Power left, decimal right) - { - return new Power(left.Value / right, left.Unit); - } - - public static double operator /(Power left, Power right) - { - return left.Watts / right.Watts; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -966,41 +602,6 @@ int CompareTo(Power other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Power left, Power right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Power left, Power right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Power left, Power right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Power left, Power right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - public static bool operator ==(Power left, Power right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - public static bool operator !=(Power left, Power right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - public override bool Equals(object obj) { if(obj is null || !(obj is Power)) diff --git a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs index 13c4d52c3a..930ca48d4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerDensity.g.cs @@ -953,669 +953,6 @@ public static PowerDensity FromWattsPerLiter(QuantityValue wattsperliter) return new PowerDensity(value, PowerDensityUnit.WattPerLiter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicFoot. - /// - public static PowerDensity? FromDecawattsPerCubicFoot(QuantityValue? decawattspercubicfoot) - { - if (decawattspercubicfoot.HasValue) - { - return FromDecawattsPerCubicFoot(decawattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicInch. - /// - public static PowerDensity? FromDecawattsPerCubicInch(QuantityValue? decawattspercubicinch) - { - if (decawattspercubicinch.HasValue) - { - return FromDecawattsPerCubicInch(decawattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerCubicMeter. - /// - public static PowerDensity? FromDecawattsPerCubicMeter(QuantityValue? decawattspercubicmeter) - { - if (decawattspercubicmeter.HasValue) - { - return FromDecawattsPerCubicMeter(decawattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DecawattsPerLiter. - /// - public static PowerDensity? FromDecawattsPerLiter(QuantityValue? decawattsperliter) - { - if (decawattsperliter.HasValue) - { - return FromDecawattsPerLiter(decawattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicFoot. - /// - public static PowerDensity? FromDeciwattsPerCubicFoot(QuantityValue? deciwattspercubicfoot) - { - if (deciwattspercubicfoot.HasValue) - { - return FromDeciwattsPerCubicFoot(deciwattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicInch. - /// - public static PowerDensity? FromDeciwattsPerCubicInch(QuantityValue? deciwattspercubicinch) - { - if (deciwattspercubicinch.HasValue) - { - return FromDeciwattsPerCubicInch(deciwattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerCubicMeter. - /// - public static PowerDensity? FromDeciwattsPerCubicMeter(QuantityValue? deciwattspercubicmeter) - { - if (deciwattspercubicmeter.HasValue) - { - return FromDeciwattsPerCubicMeter(deciwattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable DeciwattsPerLiter. - /// - public static PowerDensity? FromDeciwattsPerLiter(QuantityValue? deciwattsperliter) - { - if (deciwattsperliter.HasValue) - { - return FromDeciwattsPerLiter(deciwattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicFoot. - /// - public static PowerDensity? FromGigawattsPerCubicFoot(QuantityValue? gigawattspercubicfoot) - { - if (gigawattspercubicfoot.HasValue) - { - return FromGigawattsPerCubicFoot(gigawattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicInch. - /// - public static PowerDensity? FromGigawattsPerCubicInch(QuantityValue? gigawattspercubicinch) - { - if (gigawattspercubicinch.HasValue) - { - return FromGigawattsPerCubicInch(gigawattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerCubicMeter. - /// - public static PowerDensity? FromGigawattsPerCubicMeter(QuantityValue? gigawattspercubicmeter) - { - if (gigawattspercubicmeter.HasValue) - { - return FromGigawattsPerCubicMeter(gigawattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable GigawattsPerLiter. - /// - public static PowerDensity? FromGigawattsPerLiter(QuantityValue? gigawattsperliter) - { - if (gigawattsperliter.HasValue) - { - return FromGigawattsPerLiter(gigawattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicFoot. - /// - public static PowerDensity? FromKilowattsPerCubicFoot(QuantityValue? kilowattspercubicfoot) - { - if (kilowattspercubicfoot.HasValue) - { - return FromKilowattsPerCubicFoot(kilowattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicInch. - /// - public static PowerDensity? FromKilowattsPerCubicInch(QuantityValue? kilowattspercubicinch) - { - if (kilowattspercubicinch.HasValue) - { - return FromKilowattsPerCubicInch(kilowattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerCubicMeter. - /// - public static PowerDensity? FromKilowattsPerCubicMeter(QuantityValue? kilowattspercubicmeter) - { - if (kilowattspercubicmeter.HasValue) - { - return FromKilowattsPerCubicMeter(kilowattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable KilowattsPerLiter. - /// - public static PowerDensity? FromKilowattsPerLiter(QuantityValue? kilowattsperliter) - { - if (kilowattsperliter.HasValue) - { - return FromKilowattsPerLiter(kilowattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicFoot. - /// - public static PowerDensity? FromMegawattsPerCubicFoot(QuantityValue? megawattspercubicfoot) - { - if (megawattspercubicfoot.HasValue) - { - return FromMegawattsPerCubicFoot(megawattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicInch. - /// - public static PowerDensity? FromMegawattsPerCubicInch(QuantityValue? megawattspercubicinch) - { - if (megawattspercubicinch.HasValue) - { - return FromMegawattsPerCubicInch(megawattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerCubicMeter. - /// - public static PowerDensity? FromMegawattsPerCubicMeter(QuantityValue? megawattspercubicmeter) - { - if (megawattspercubicmeter.HasValue) - { - return FromMegawattsPerCubicMeter(megawattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MegawattsPerLiter. - /// - public static PowerDensity? FromMegawattsPerLiter(QuantityValue? megawattsperliter) - { - if (megawattsperliter.HasValue) - { - return FromMegawattsPerLiter(megawattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicFoot. - /// - public static PowerDensity? FromMicrowattsPerCubicFoot(QuantityValue? microwattspercubicfoot) - { - if (microwattspercubicfoot.HasValue) - { - return FromMicrowattsPerCubicFoot(microwattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicInch. - /// - public static PowerDensity? FromMicrowattsPerCubicInch(QuantityValue? microwattspercubicinch) - { - if (microwattspercubicinch.HasValue) - { - return FromMicrowattsPerCubicInch(microwattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerCubicMeter. - /// - public static PowerDensity? FromMicrowattsPerCubicMeter(QuantityValue? microwattspercubicmeter) - { - if (microwattspercubicmeter.HasValue) - { - return FromMicrowattsPerCubicMeter(microwattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MicrowattsPerLiter. - /// - public static PowerDensity? FromMicrowattsPerLiter(QuantityValue? microwattsperliter) - { - if (microwattsperliter.HasValue) - { - return FromMicrowattsPerLiter(microwattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicFoot. - /// - public static PowerDensity? FromMilliwattsPerCubicFoot(QuantityValue? milliwattspercubicfoot) - { - if (milliwattspercubicfoot.HasValue) - { - return FromMilliwattsPerCubicFoot(milliwattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicInch. - /// - public static PowerDensity? FromMilliwattsPerCubicInch(QuantityValue? milliwattspercubicinch) - { - if (milliwattspercubicinch.HasValue) - { - return FromMilliwattsPerCubicInch(milliwattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerCubicMeter. - /// - public static PowerDensity? FromMilliwattsPerCubicMeter(QuantityValue? milliwattspercubicmeter) - { - if (milliwattspercubicmeter.HasValue) - { - return FromMilliwattsPerCubicMeter(milliwattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable MilliwattsPerLiter. - /// - public static PowerDensity? FromMilliwattsPerLiter(QuantityValue? milliwattsperliter) - { - if (milliwattsperliter.HasValue) - { - return FromMilliwattsPerLiter(milliwattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicFoot. - /// - public static PowerDensity? FromNanowattsPerCubicFoot(QuantityValue? nanowattspercubicfoot) - { - if (nanowattspercubicfoot.HasValue) - { - return FromNanowattsPerCubicFoot(nanowattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicInch. - /// - public static PowerDensity? FromNanowattsPerCubicInch(QuantityValue? nanowattspercubicinch) - { - if (nanowattspercubicinch.HasValue) - { - return FromNanowattsPerCubicInch(nanowattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerCubicMeter. - /// - public static PowerDensity? FromNanowattsPerCubicMeter(QuantityValue? nanowattspercubicmeter) - { - if (nanowattspercubicmeter.HasValue) - { - return FromNanowattsPerCubicMeter(nanowattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable NanowattsPerLiter. - /// - public static PowerDensity? FromNanowattsPerLiter(QuantityValue? nanowattsperliter) - { - if (nanowattsperliter.HasValue) - { - return FromNanowattsPerLiter(nanowattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicFoot. - /// - public static PowerDensity? FromPicowattsPerCubicFoot(QuantityValue? picowattspercubicfoot) - { - if (picowattspercubicfoot.HasValue) - { - return FromPicowattsPerCubicFoot(picowattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicInch. - /// - public static PowerDensity? FromPicowattsPerCubicInch(QuantityValue? picowattspercubicinch) - { - if (picowattspercubicinch.HasValue) - { - return FromPicowattsPerCubicInch(picowattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerCubicMeter. - /// - public static PowerDensity? FromPicowattsPerCubicMeter(QuantityValue? picowattspercubicmeter) - { - if (picowattspercubicmeter.HasValue) - { - return FromPicowattsPerCubicMeter(picowattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable PicowattsPerLiter. - /// - public static PowerDensity? FromPicowattsPerLiter(QuantityValue? picowattsperliter) - { - if (picowattsperliter.HasValue) - { - return FromPicowattsPerLiter(picowattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicFoot. - /// - public static PowerDensity? FromTerawattsPerCubicFoot(QuantityValue? terawattspercubicfoot) - { - if (terawattspercubicfoot.HasValue) - { - return FromTerawattsPerCubicFoot(terawattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicInch. - /// - public static PowerDensity? FromTerawattsPerCubicInch(QuantityValue? terawattspercubicinch) - { - if (terawattspercubicinch.HasValue) - { - return FromTerawattsPerCubicInch(terawattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerCubicMeter. - /// - public static PowerDensity? FromTerawattsPerCubicMeter(QuantityValue? terawattspercubicmeter) - { - if (terawattspercubicmeter.HasValue) - { - return FromTerawattsPerCubicMeter(terawattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable TerawattsPerLiter. - /// - public static PowerDensity? FromTerawattsPerLiter(QuantityValue? terawattsperliter) - { - if (terawattsperliter.HasValue) - { - return FromTerawattsPerLiter(terawattsperliter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicFoot. - /// - public static PowerDensity? FromWattsPerCubicFoot(QuantityValue? wattspercubicfoot) - { - if (wattspercubicfoot.HasValue) - { - return FromWattsPerCubicFoot(wattspercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicInch. - /// - public static PowerDensity? FromWattsPerCubicInch(QuantityValue? wattspercubicinch) - { - if (wattspercubicinch.HasValue) - { - return FromWattsPerCubicInch(wattspercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable WattsPerCubicMeter. - /// - public static PowerDensity? FromWattsPerCubicMeter(QuantityValue? wattspercubicmeter) - { - if (wattspercubicmeter.HasValue) - { - return FromWattsPerCubicMeter(wattspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerDensity from nullable WattsPerLiter. - /// - public static PowerDensity? FromWattsPerLiter(QuantityValue? wattsperliter) - { - if (wattsperliter.HasValue) - { - return FromWattsPerLiter(wattsperliter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1634,25 +971,6 @@ public static PowerDensity From(QuantityValue value, PowerDensityUnit fromUnit) return new PowerDensity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PowerDensity unit value. - public static PowerDensity? From(QuantityValue? value, PowerDensityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new PowerDensity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1695,48 +1013,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static PowerDensity operator -(PowerDensity right) - { - return new PowerDensity(-right.Value, right.Unit); - } - - public static PowerDensity operator +(PowerDensity left, PowerDensity right) - { - return new PowerDensity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static PowerDensity operator -(PowerDensity left, PowerDensity right) - { - return new PowerDensity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static PowerDensity operator *(double left, PowerDensity right) - { - return new PowerDensity(left * right.Value, right.Unit); - } - - public static PowerDensity operator *(PowerDensity left, double right) - { - return new PowerDensity(left.Value * right, left.Unit); - } - - public static PowerDensity operator /(PowerDensity left, double right) - { - return new PowerDensity(left.Value / right, left.Unit); - } - - public static double operator /(PowerDensity left, PowerDensity right) - { - return left.WattsPerCubicMeter / right.WattsPerCubicMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1758,43 +1034,6 @@ int CompareTo(PowerDensity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(PowerDensity left, PowerDensity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(PowerDensity left, PowerDensity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(PowerDensity left, PowerDensity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(PowerDensity left, PowerDensity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(PowerDensity left, PowerDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(PowerDensity left, PowerDensity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs index 640732a8b9..52eff737d3 100644 --- a/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PowerRatio.g.cs @@ -187,39 +187,6 @@ public static PowerRatio FromDecibelWatts(QuantityValue decibelwatts) return new PowerRatio(value, PowerRatioUnit.DecibelWatt); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable PowerRatio from nullable DecibelMilliwatts. - /// - public static PowerRatio? FromDecibelMilliwatts(QuantityValue? decibelmilliwatts) - { - if (decibelmilliwatts.HasValue) - { - return FromDecibelMilliwatts(decibelmilliwatts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PowerRatio from nullable DecibelWatts. - /// - public static PowerRatio? FromDecibelWatts(QuantityValue? decibelwatts) - { - if (decibelwatts.HasValue) - { - return FromDecibelWatts(decibelwatts.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -238,25 +205,6 @@ public static PowerRatio From(QuantityValue value, PowerRatioUnit fromUnit) return new PowerRatio((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PowerRatio unit value. - public static PowerRatio? From(QuantityValue? value, PowerRatioUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new PowerRatio((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -299,56 +247,6 @@ public static string GetAbbreviation( #endregion - #region Logarithmic Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static PowerRatio operator -(PowerRatio right) - { - return new PowerRatio(-right.Value, right.Unit); - } - - public static PowerRatio operator +(PowerRatio left, PowerRatio right) - { - // Logarithmic addition - // Formula: 10*log10(10^(x/10) + 10^(y/10)) - return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) + Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); - } - - public static PowerRatio operator -(PowerRatio left, PowerRatio right) - { - // Logarithmic subtraction - // Formula: 10*log10(10^(x/10) - 10^(y/10)) - return new PowerRatio(10*Math.Log10(Math.Pow(10, left.Value/10) - Math.Pow(10, right.AsBaseNumericType(left.Unit)/10)), left.Unit); - } - - public static PowerRatio operator *(double left, PowerRatio right) - { - // Logarithmic multiplication = addition - return new PowerRatio(left + right.Value, right.Unit); - } - - public static PowerRatio operator *(PowerRatio left, double right) - { - // Logarithmic multiplication = addition - return new PowerRatio(left.Value + (double)right, left.Unit); - } - - public static PowerRatio operator /(PowerRatio left, double right) - { - // Logarithmic division = subtraction - return new PowerRatio(left.Value - (double)right, left.Unit); - } - - public static double operator /(PowerRatio left, PowerRatio right) - { - // Logarithmic division = subtraction - return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -370,43 +268,6 @@ int CompareTo(PowerRatio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(PowerRatio left, PowerRatio right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(PowerRatio left, PowerRatio right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(PowerRatio left, PowerRatio right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(PowerRatio left, PowerRatio right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(PowerRatio left, PowerRatio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(PowerRatio left, PowerRatio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs index 393f781e16..3985badc4d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Pressure.g.cs @@ -846,579 +846,6 @@ public static Pressure FromTorrs(QuantityValue torrs) return new Pressure(value, PressureUnit.Torr); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Pressure from nullable Atmospheres. - /// - public static Pressure? FromAtmospheres(QuantityValue? atmospheres) - { - if (atmospheres.HasValue) - { - return FromAtmospheres(atmospheres.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Bars. - /// - public static Pressure? FromBars(QuantityValue? bars) - { - if (bars.HasValue) - { - return FromBars(bars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Centibars. - /// - public static Pressure? FromCentibars(QuantityValue? centibars) - { - if (centibars.HasValue) - { - return FromCentibars(centibars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Decapascals. - /// - public static Pressure? FromDecapascals(QuantityValue? decapascals) - { - if (decapascals.HasValue) - { - return FromDecapascals(decapascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Decibars. - /// - public static Pressure? FromDecibars(QuantityValue? decibars) - { - if (decibars.HasValue) - { - return FromDecibars(decibars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable FeetOfHead. - /// - public static Pressure? FromFeetOfHead(QuantityValue? feetofhead) - { - if (feetofhead.HasValue) - { - return FromFeetOfHead(feetofhead.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Gigapascals. - /// - public static Pressure? FromGigapascals(QuantityValue? gigapascals) - { - if (gigapascals.HasValue) - { - return FromGigapascals(gigapascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Hectopascals. - /// - public static Pressure? FromHectopascals(QuantityValue? hectopascals) - { - if (hectopascals.HasValue) - { - return FromHectopascals(hectopascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable InchesOfMercury. - /// - public static Pressure? FromInchesOfMercury(QuantityValue? inchesofmercury) - { - if (inchesofmercury.HasValue) - { - return FromInchesOfMercury(inchesofmercury.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Kilobars. - /// - public static Pressure? FromKilobars(QuantityValue? kilobars) - { - if (kilobars.HasValue) - { - return FromKilobars(kilobars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareCentimeter. - /// - public static Pressure? FromKilogramsForcePerSquareCentimeter(QuantityValue? kilogramsforcepersquarecentimeter) - { - if (kilogramsforcepersquarecentimeter.HasValue) - { - return FromKilogramsForcePerSquareCentimeter(kilogramsforcepersquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareMeter. - /// - public static Pressure? FromKilogramsForcePerSquareMeter(QuantityValue? kilogramsforcepersquaremeter) - { - if (kilogramsforcepersquaremeter.HasValue) - { - return FromKilogramsForcePerSquareMeter(kilogramsforcepersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilogramsForcePerSquareMillimeter. - /// - public static Pressure? FromKilogramsForcePerSquareMillimeter(QuantityValue? kilogramsforcepersquaremillimeter) - { - if (kilogramsforcepersquaremillimeter.HasValue) - { - return FromKilogramsForcePerSquareMillimeter(kilogramsforcepersquaremillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareCentimeter. - /// - public static Pressure? FromKilonewtonsPerSquareCentimeter(QuantityValue? kilonewtonspersquarecentimeter) - { - if (kilonewtonspersquarecentimeter.HasValue) - { - return FromKilonewtonsPerSquareCentimeter(kilonewtonspersquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareMeter. - /// - public static Pressure? FromKilonewtonsPerSquareMeter(QuantityValue? kilonewtonspersquaremeter) - { - if (kilonewtonspersquaremeter.HasValue) - { - return FromKilonewtonsPerSquareMeter(kilonewtonspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilonewtonsPerSquareMillimeter. - /// - public static Pressure? FromKilonewtonsPerSquareMillimeter(QuantityValue? kilonewtonspersquaremillimeter) - { - if (kilonewtonspersquaremillimeter.HasValue) - { - return FromKilonewtonsPerSquareMillimeter(kilonewtonspersquaremillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Kilopascals. - /// - public static Pressure? FromKilopascals(QuantityValue? kilopascals) - { - if (kilopascals.HasValue) - { - return FromKilopascals(kilopascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilopoundsForcePerSquareFoot. - /// - public static Pressure? FromKilopoundsForcePerSquareFoot(QuantityValue? kilopoundsforcepersquarefoot) - { - if (kilopoundsforcepersquarefoot.HasValue) - { - return FromKilopoundsForcePerSquareFoot(kilopoundsforcepersquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable KilopoundsForcePerSquareInch. - /// - public static Pressure? FromKilopoundsForcePerSquareInch(QuantityValue? kilopoundsforcepersquareinch) - { - if (kilopoundsforcepersquareinch.HasValue) - { - return FromKilopoundsForcePerSquareInch(kilopoundsforcepersquareinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Megabars. - /// - public static Pressure? FromMegabars(QuantityValue? megabars) - { - if (megabars.HasValue) - { - return FromMegabars(megabars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable MeganewtonsPerSquareMeter. - /// - public static Pressure? FromMeganewtonsPerSquareMeter(QuantityValue? meganewtonspersquaremeter) - { - if (meganewtonspersquaremeter.HasValue) - { - return FromMeganewtonsPerSquareMeter(meganewtonspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Megapascals. - /// - public static Pressure? FromMegapascals(QuantityValue? megapascals) - { - if (megapascals.HasValue) - { - return FromMegapascals(megapascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable MetersOfHead. - /// - public static Pressure? FromMetersOfHead(QuantityValue? metersofhead) - { - if (metersofhead.HasValue) - { - return FromMetersOfHead(metersofhead.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Micropascals. - /// - public static Pressure? FromMicropascals(QuantityValue? micropascals) - { - if (micropascals.HasValue) - { - return FromMicropascals(micropascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Millibars. - /// - public static Pressure? FromMillibars(QuantityValue? millibars) - { - if (millibars.HasValue) - { - return FromMillibars(millibars.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable MillimetersOfMercury. - /// - public static Pressure? FromMillimetersOfMercury(QuantityValue? millimetersofmercury) - { - if (millimetersofmercury.HasValue) - { - return FromMillimetersOfMercury(millimetersofmercury.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareCentimeter. - /// - public static Pressure? FromNewtonsPerSquareCentimeter(QuantityValue? newtonspersquarecentimeter) - { - if (newtonspersquarecentimeter.HasValue) - { - return FromNewtonsPerSquareCentimeter(newtonspersquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareMeter. - /// - public static Pressure? FromNewtonsPerSquareMeter(QuantityValue? newtonspersquaremeter) - { - if (newtonspersquaremeter.HasValue) - { - return FromNewtonsPerSquareMeter(newtonspersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable NewtonsPerSquareMillimeter. - /// - public static Pressure? FromNewtonsPerSquareMillimeter(QuantityValue? newtonspersquaremillimeter) - { - if (newtonspersquaremillimeter.HasValue) - { - return FromNewtonsPerSquareMillimeter(newtonspersquaremillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Pascals. - /// - public static Pressure? FromPascals(QuantityValue? pascals) - { - if (pascals.HasValue) - { - return FromPascals(pascals.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable PoundsForcePerSquareFoot. - /// - public static Pressure? FromPoundsForcePerSquareFoot(QuantityValue? poundsforcepersquarefoot) - { - if (poundsforcepersquarefoot.HasValue) - { - return FromPoundsForcePerSquareFoot(poundsforcepersquarefoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable PoundsForcePerSquareInch. - /// - public static Pressure? FromPoundsForcePerSquareInch(QuantityValue? poundsforcepersquareinch) - { - if (poundsforcepersquareinch.HasValue) - { - return FromPoundsForcePerSquareInch(poundsforcepersquareinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Psi. - /// - public static Pressure? FromPsi(QuantityValue? psi) - { - if (psi.HasValue) - { - return FromPsi(psi.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable TechnicalAtmospheres. - /// - public static Pressure? FromTechnicalAtmospheres(QuantityValue? technicalatmospheres) - { - if (technicalatmospheres.HasValue) - { - return FromTechnicalAtmospheres(technicalatmospheres.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareCentimeter. - /// - public static Pressure? FromTonnesForcePerSquareCentimeter(QuantityValue? tonnesforcepersquarecentimeter) - { - if (tonnesforcepersquarecentimeter.HasValue) - { - return FromTonnesForcePerSquareCentimeter(tonnesforcepersquarecentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareMeter. - /// - public static Pressure? FromTonnesForcePerSquareMeter(QuantityValue? tonnesforcepersquaremeter) - { - if (tonnesforcepersquaremeter.HasValue) - { - return FromTonnesForcePerSquareMeter(tonnesforcepersquaremeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable TonnesForcePerSquareMillimeter. - /// - public static Pressure? FromTonnesForcePerSquareMillimeter(QuantityValue? tonnesforcepersquaremillimeter) - { - if (tonnesforcepersquaremillimeter.HasValue) - { - return FromTonnesForcePerSquareMillimeter(tonnesforcepersquaremillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Pressure from nullable Torrs. - /// - public static Pressure? FromTorrs(QuantityValue? torrs) - { - if (torrs.HasValue) - { - return FromTorrs(torrs.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1437,25 +864,6 @@ public static Pressure From(QuantityValue value, PressureUnit fromUnit) return new Pressure((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Pressure unit value. - public static Pressure? From(QuantityValue? value, PressureUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Pressure((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1498,48 +906,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Pressure operator -(Pressure right) - { - return new Pressure(-right.Value, right.Unit); - } - - public static Pressure operator +(Pressure left, Pressure right) - { - return new Pressure(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Pressure operator -(Pressure left, Pressure right) - { - return new Pressure(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Pressure operator *(double left, Pressure right) - { - return new Pressure(left * right.Value, right.Unit); - } - - public static Pressure operator *(Pressure left, double right) - { - return new Pressure(left.Value * right, left.Unit); - } - - public static Pressure operator /(Pressure left, double right) - { - return new Pressure(left.Value / right, left.Unit); - } - - public static double operator /(Pressure left, Pressure right) - { - return left.Pascals / right.Pascals; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1561,43 +927,6 @@ int CompareTo(Pressure other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Pressure left, Pressure right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Pressure left, Pressure right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Pressure left, Pressure right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Pressure left, Pressure right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Pressure left, Pressure right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Pressure left, Pressure right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs index 0e8c8c9b63..ed4d8c9a05 100644 --- a/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/PressureChangeRate.g.cs @@ -233,69 +233,6 @@ public static PressureChangeRate FromPascalsPerSecond(QuantityValue pascalsperse return new PressureChangeRate(value, PressureChangeRateUnit.PascalPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable PressureChangeRate from nullable AtmospheresPerSecond. - /// - public static PressureChangeRate? FromAtmospheresPerSecond(QuantityValue? atmospherespersecond) - { - if (atmospherespersecond.HasValue) - { - return FromAtmospheresPerSecond(atmospherespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PressureChangeRate from nullable KilopascalsPerSecond. - /// - public static PressureChangeRate? FromKilopascalsPerSecond(QuantityValue? kilopascalspersecond) - { - if (kilopascalspersecond.HasValue) - { - return FromKilopascalsPerSecond(kilopascalspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PressureChangeRate from nullable MegapascalsPerSecond. - /// - public static PressureChangeRate? FromMegapascalsPerSecond(QuantityValue? megapascalspersecond) - { - if (megapascalspersecond.HasValue) - { - return FromMegapascalsPerSecond(megapascalspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable PressureChangeRate from nullable PascalsPerSecond. - /// - public static PressureChangeRate? FromPascalsPerSecond(QuantityValue? pascalspersecond) - { - if (pascalspersecond.HasValue) - { - return FromPascalsPerSecond(pascalspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static PressureChangeRate From(QuantityValue value, PressureChangeRateUni return new PressureChangeRate((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// PressureChangeRate unit value. - public static PressureChangeRate? From(QuantityValue? value, PressureChangeRateUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new PressureChangeRate((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static PressureChangeRate operator -(PressureChangeRate right) - { - return new PressureChangeRate(-right.Value, right.Unit); - } - - public static PressureChangeRate operator +(PressureChangeRate left, PressureChangeRate right) - { - return new PressureChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static PressureChangeRate operator -(PressureChangeRate left, PressureChangeRate right) - { - return new PressureChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static PressureChangeRate operator *(double left, PressureChangeRate right) - { - return new PressureChangeRate(left * right.Value, right.Unit); - } - - public static PressureChangeRate operator *(PressureChangeRate left, double right) - { - return new PressureChangeRate(left.Value * right, left.Unit); - } - - public static PressureChangeRate operator /(PressureChangeRate left, double right) - { - return new PressureChangeRate(left.Value / right, left.Unit); - } - - public static double operator /(PressureChangeRate left, PressureChangeRate right) - { - return left.PascalsPerSecond / right.PascalsPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(PressureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(PressureChangeRate left, PressureChangeRate right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(PressureChangeRate left, PressureChangeRate right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(PressureChangeRate left, PressureChangeRate right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(PressureChangeRate left, PressureChangeRate right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(PressureChangeRate left, PressureChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(PressureChangeRate left, PressureChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs index cbea7ccb83..bdf1458939 100644 --- a/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Ratio.g.cs @@ -259,99 +259,6 @@ public static Ratio FromPercent(QuantityValue percent) return new Ratio(value, RatioUnit.Percent); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Ratio from nullable DecimalFractions. - /// - public static Ratio? FromDecimalFractions(QuantityValue? decimalfractions) - { - if (decimalfractions.HasValue) - { - return FromDecimalFractions(decimalfractions.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Ratio from nullable PartsPerBillion. - /// - public static Ratio? FromPartsPerBillion(QuantityValue? partsperbillion) - { - if (partsperbillion.HasValue) - { - return FromPartsPerBillion(partsperbillion.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Ratio from nullable PartsPerMillion. - /// - public static Ratio? FromPartsPerMillion(QuantityValue? partspermillion) - { - if (partspermillion.HasValue) - { - return FromPartsPerMillion(partspermillion.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Ratio from nullable PartsPerThousand. - /// - public static Ratio? FromPartsPerThousand(QuantityValue? partsperthousand) - { - if (partsperthousand.HasValue) - { - return FromPartsPerThousand(partsperthousand.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Ratio from nullable PartsPerTrillion. - /// - public static Ratio? FromPartsPerTrillion(QuantityValue? partspertrillion) - { - if (partspertrillion.HasValue) - { - return FromPartsPerTrillion(partspertrillion.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Ratio from nullable Percent. - /// - public static Ratio? FromPercent(QuantityValue? percent) - { - if (percent.HasValue) - { - return FromPercent(percent.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -370,25 +277,6 @@ public static Ratio From(QuantityValue value, RatioUnit fromUnit) return new Ratio((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Ratio unit value. - public static Ratio? From(QuantityValue? value, RatioUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Ratio((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -431,48 +319,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Ratio operator -(Ratio right) - { - return new Ratio(-right.Value, right.Unit); - } - - public static Ratio operator +(Ratio left, Ratio right) - { - return new Ratio(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Ratio operator -(Ratio left, Ratio right) - { - return new Ratio(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Ratio operator *(double left, Ratio right) - { - return new Ratio(left * right.Value, right.Unit); - } - - public static Ratio operator *(Ratio left, double right) - { - return new Ratio(left.Value * right, left.Unit); - } - - public static Ratio operator /(Ratio left, double right) - { - return new Ratio(left.Value / right, left.Unit); - } - - public static double operator /(Ratio left, Ratio right) - { - return left.DecimalFractions / right.DecimalFractions; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -494,43 +340,6 @@ int CompareTo(Ratio other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Ratio left, Ratio right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Ratio left, Ratio right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Ratio left, Ratio right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Ratio left, Ratio right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Ratio left, Ratio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Ratio left, Ratio right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs index f4a6ac7ad7..f3176c0e6d 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactiveEnergy.g.cs @@ -215,54 +215,6 @@ public static ReactiveEnergy FromVoltampereReactiveHours(QuantityValue voltamper return new ReactiveEnergy(value, ReactiveEnergyUnit.VoltampereReactiveHour); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ReactiveEnergy from nullable KilovoltampereReactiveHours. - /// - public static ReactiveEnergy? FromKilovoltampereReactiveHours(QuantityValue? kilovoltamperereactivehours) - { - if (kilovoltamperereactivehours.HasValue) - { - return FromKilovoltampereReactiveHours(kilovoltamperereactivehours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ReactiveEnergy from nullable MegavoltampereReactiveHours. - /// - public static ReactiveEnergy? FromMegavoltampereReactiveHours(QuantityValue? megavoltamperereactivehours) - { - if (megavoltamperereactivehours.HasValue) - { - return FromMegavoltampereReactiveHours(megavoltamperereactivehours.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ReactiveEnergy from nullable VoltampereReactiveHours. - /// - public static ReactiveEnergy? FromVoltampereReactiveHours(QuantityValue? voltamperereactivehours) - { - if (voltamperereactivehours.HasValue) - { - return FromVoltampereReactiveHours(voltamperereactivehours.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static ReactiveEnergy From(QuantityValue value, ReactiveEnergyUnit fromUn return new ReactiveEnergy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ReactiveEnergy unit value. - public static ReactiveEnergy? From(QuantityValue? value, ReactiveEnergyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ReactiveEnergy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ReactiveEnergy operator -(ReactiveEnergy right) - { - return new ReactiveEnergy(-right.Value, right.Unit); - } - - public static ReactiveEnergy operator +(ReactiveEnergy left, ReactiveEnergy right) - { - return new ReactiveEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ReactiveEnergy operator -(ReactiveEnergy left, ReactiveEnergy right) - { - return new ReactiveEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ReactiveEnergy operator *(double left, ReactiveEnergy right) - { - return new ReactiveEnergy(left * right.Value, right.Unit); - } - - public static ReactiveEnergy operator *(ReactiveEnergy left, double right) - { - return new ReactiveEnergy(left.Value * right, left.Unit); - } - - public static ReactiveEnergy operator /(ReactiveEnergy left, double right) - { - return new ReactiveEnergy(left.Value / right, left.Unit); - } - - public static double operator /(ReactiveEnergy left, ReactiveEnergy right) - { - return left.VoltampereReactiveHours / right.VoltampereReactiveHours; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(ReactiveEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ReactiveEnergy left, ReactiveEnergy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ReactiveEnergy left, ReactiveEnergy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ReactiveEnergy left, ReactiveEnergy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ReactiveEnergy left, ReactiveEnergy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ReactiveEnergy left, ReactiveEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ReactiveEnergy left, ReactiveEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs index ca375852c1..b5e86043c2 100644 --- a/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ReactivePower.g.cs @@ -233,69 +233,6 @@ public static ReactivePower FromVoltamperesReactive(QuantityValue voltamperesrea return new ReactivePower(value, ReactivePowerUnit.VoltampereReactive); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ReactivePower from nullable GigavoltamperesReactive. - /// - public static ReactivePower? FromGigavoltamperesReactive(QuantityValue? gigavoltamperesreactive) - { - if (gigavoltamperesreactive.HasValue) - { - return FromGigavoltamperesReactive(gigavoltamperesreactive.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ReactivePower from nullable KilovoltamperesReactive. - /// - public static ReactivePower? FromKilovoltamperesReactive(QuantityValue? kilovoltamperesreactive) - { - if (kilovoltamperesreactive.HasValue) - { - return FromKilovoltamperesReactive(kilovoltamperesreactive.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ReactivePower from nullable MegavoltamperesReactive. - /// - public static ReactivePower? FromMegavoltamperesReactive(QuantityValue? megavoltamperesreactive) - { - if (megavoltamperesreactive.HasValue) - { - return FromMegavoltamperesReactive(megavoltamperesreactive.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ReactivePower from nullable VoltamperesReactive. - /// - public static ReactivePower? FromVoltamperesReactive(QuantityValue? voltamperesreactive) - { - if (voltamperesreactive.HasValue) - { - return FromVoltamperesReactive(voltamperesreactive.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -314,25 +251,6 @@ public static ReactivePower From(QuantityValue value, ReactivePowerUnit fromUnit return new ReactivePower((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ReactivePower unit value. - public static ReactivePower? From(QuantityValue? value, ReactivePowerUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ReactivePower((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -375,48 +293,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ReactivePower operator -(ReactivePower right) - { - return new ReactivePower(-right.Value, right.Unit); - } - - public static ReactivePower operator +(ReactivePower left, ReactivePower right) - { - return new ReactivePower(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ReactivePower operator -(ReactivePower left, ReactivePower right) - { - return new ReactivePower(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ReactivePower operator *(double left, ReactivePower right) - { - return new ReactivePower(left * right.Value, right.Unit); - } - - public static ReactivePower operator *(ReactivePower left, double right) - { - return new ReactivePower(left.Value * right, left.Unit); - } - - public static ReactivePower operator /(ReactivePower left, double right) - { - return new ReactivePower(left.Value / right, left.Unit); - } - - public static double operator /(ReactivePower left, ReactivePower right) - { - return left.VoltamperesReactive / right.VoltamperesReactive; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -438,43 +314,6 @@ int CompareTo(ReactivePower other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ReactivePower left, ReactivePower right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ReactivePower left, ReactivePower right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ReactivePower left, ReactivePower right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ReactivePower left, ReactivePower right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ReactivePower left, ReactivePower right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ReactivePower left, ReactivePower right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs index 7b66ab215e..07059f2f91 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalAcceleration.g.cs @@ -215,54 +215,6 @@ public static RotationalAcceleration FromRevolutionsPerMinutePerSecond(QuantityV return new RotationalAcceleration(value, RotationalAccelerationUnit.RevolutionPerMinutePerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable RotationalAcceleration from nullable DegreesPerSecondSquared. - /// - public static RotationalAcceleration? FromDegreesPerSecondSquared(QuantityValue? degreespersecondsquared) - { - if (degreespersecondsquared.HasValue) - { - return FromDegreesPerSecondSquared(degreespersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalAcceleration from nullable RadiansPerSecondSquared. - /// - public static RotationalAcceleration? FromRadiansPerSecondSquared(QuantityValue? radianspersecondsquared) - { - if (radianspersecondsquared.HasValue) - { - return FromRadiansPerSecondSquared(radianspersecondsquared.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalAcceleration from nullable RevolutionsPerMinutePerSecond. - /// - public static RotationalAcceleration? FromRevolutionsPerMinutePerSecond(QuantityValue? revolutionsperminutepersecond) - { - if (revolutionsperminutepersecond.HasValue) - { - return FromRevolutionsPerMinutePerSecond(revolutionsperminutepersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static RotationalAcceleration From(QuantityValue value, RotationalAcceler return new RotationalAcceleration((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalAcceleration unit value. - public static RotationalAcceleration? From(QuantityValue? value, RotationalAccelerationUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new RotationalAcceleration((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static RotationalAcceleration operator -(RotationalAcceleration right) - { - return new RotationalAcceleration(-right.Value, right.Unit); - } - - public static RotationalAcceleration operator +(RotationalAcceleration left, RotationalAcceleration right) - { - return new RotationalAcceleration(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalAcceleration operator -(RotationalAcceleration left, RotationalAcceleration right) - { - return new RotationalAcceleration(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalAcceleration operator *(double left, RotationalAcceleration right) - { - return new RotationalAcceleration(left * right.Value, right.Unit); - } - - public static RotationalAcceleration operator *(RotationalAcceleration left, double right) - { - return new RotationalAcceleration(left.Value * right, left.Unit); - } - - public static RotationalAcceleration operator /(RotationalAcceleration left, double right) - { - return new RotationalAcceleration(left.Value / right, left.Unit); - } - - public static double operator /(RotationalAcceleration left, RotationalAcceleration right) - { - return left.RadiansPerSecondSquared / right.RadiansPerSecondSquared; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(RotationalAcceleration other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(RotationalAcceleration left, RotationalAcceleration right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(RotationalAcceleration left, RotationalAcceleration right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(RotationalAcceleration left, RotationalAcceleration right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(RotationalAcceleration left, RotationalAcceleration right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(RotationalAcceleration left, RotationalAcceleration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(RotationalAcceleration left, RotationalAcceleration right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs index 7584156b54..db21e25f38 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalSpeed.g.cs @@ -395,204 +395,6 @@ public static RotationalSpeed FromRevolutionsPerSecond(QuantityValue revolutions return new RotationalSpeed(value, RotationalSpeedUnit.RevolutionPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable RotationalSpeed from nullable CentiradiansPerSecond. - /// - public static RotationalSpeed? FromCentiradiansPerSecond(QuantityValue? centiradianspersecond) - { - if (centiradianspersecond.HasValue) - { - return FromCentiradiansPerSecond(centiradianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable DeciradiansPerSecond. - /// - public static RotationalSpeed? FromDeciradiansPerSecond(QuantityValue? deciradianspersecond) - { - if (deciradianspersecond.HasValue) - { - return FromDeciradiansPerSecond(deciradianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable DegreesPerMinute. - /// - public static RotationalSpeed? FromDegreesPerMinute(QuantityValue? degreesperminute) - { - if (degreesperminute.HasValue) - { - return FromDegreesPerMinute(degreesperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable DegreesPerSecond. - /// - public static RotationalSpeed? FromDegreesPerSecond(QuantityValue? degreespersecond) - { - if (degreespersecond.HasValue) - { - return FromDegreesPerSecond(degreespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable MicrodegreesPerSecond. - /// - public static RotationalSpeed? FromMicrodegreesPerSecond(QuantityValue? microdegreespersecond) - { - if (microdegreespersecond.HasValue) - { - return FromMicrodegreesPerSecond(microdegreespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable MicroradiansPerSecond. - /// - public static RotationalSpeed? FromMicroradiansPerSecond(QuantityValue? microradianspersecond) - { - if (microradianspersecond.HasValue) - { - return FromMicroradiansPerSecond(microradianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable MillidegreesPerSecond. - /// - public static RotationalSpeed? FromMillidegreesPerSecond(QuantityValue? millidegreespersecond) - { - if (millidegreespersecond.HasValue) - { - return FromMillidegreesPerSecond(millidegreespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable MilliradiansPerSecond. - /// - public static RotationalSpeed? FromMilliradiansPerSecond(QuantityValue? milliradianspersecond) - { - if (milliradianspersecond.HasValue) - { - return FromMilliradiansPerSecond(milliradianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable NanodegreesPerSecond. - /// - public static RotationalSpeed? FromNanodegreesPerSecond(QuantityValue? nanodegreespersecond) - { - if (nanodegreespersecond.HasValue) - { - return FromNanodegreesPerSecond(nanodegreespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable NanoradiansPerSecond. - /// - public static RotationalSpeed? FromNanoradiansPerSecond(QuantityValue? nanoradianspersecond) - { - if (nanoradianspersecond.HasValue) - { - return FromNanoradiansPerSecond(nanoradianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable RadiansPerSecond. - /// - public static RotationalSpeed? FromRadiansPerSecond(QuantityValue? radianspersecond) - { - if (radianspersecond.HasValue) - { - return FromRadiansPerSecond(radianspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable RevolutionsPerMinute. - /// - public static RotationalSpeed? FromRevolutionsPerMinute(QuantityValue? revolutionsperminute) - { - if (revolutionsperminute.HasValue) - { - return FromRevolutionsPerMinute(revolutionsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalSpeed from nullable RevolutionsPerSecond. - /// - public static RotationalSpeed? FromRevolutionsPerSecond(QuantityValue? revolutionspersecond) - { - if (revolutionspersecond.HasValue) - { - return FromRevolutionsPerSecond(revolutionspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -611,25 +413,6 @@ public static RotationalSpeed From(QuantityValue value, RotationalSpeedUnit from return new RotationalSpeed((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalSpeed unit value. - public static RotationalSpeed? From(QuantityValue? value, RotationalSpeedUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new RotationalSpeed((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -672,48 +455,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static RotationalSpeed operator -(RotationalSpeed right) - { - return new RotationalSpeed(-right.Value, right.Unit); - } - - public static RotationalSpeed operator +(RotationalSpeed left, RotationalSpeed right) - { - return new RotationalSpeed(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalSpeed operator -(RotationalSpeed left, RotationalSpeed right) - { - return new RotationalSpeed(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalSpeed operator *(double left, RotationalSpeed right) - { - return new RotationalSpeed(left * right.Value, right.Unit); - } - - public static RotationalSpeed operator *(RotationalSpeed left, double right) - { - return new RotationalSpeed(left.Value * right, left.Unit); - } - - public static RotationalSpeed operator /(RotationalSpeed left, double right) - { - return new RotationalSpeed(left.Value / right, left.Unit); - } - - public static double operator /(RotationalSpeed left, RotationalSpeed right) - { - return left.RadiansPerSecond / right.RadiansPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -735,43 +476,6 @@ int CompareTo(RotationalSpeed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(RotationalSpeed left, RotationalSpeed right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(RotationalSpeed left, RotationalSpeed right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(RotationalSpeed left, RotationalSpeed right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(RotationalSpeed left, RotationalSpeed right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(RotationalSpeed left, RotationalSpeed right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(RotationalSpeed left, RotationalSpeed right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs index 9160f77c98..bcac3cca68 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffness.g.cs @@ -215,54 +215,6 @@ public static RotationalStiffness FromNewtonMetersPerRadian(QuantityValue newton return new RotationalStiffness(value, RotationalStiffnessUnit.NewtonMeterPerRadian); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable RotationalStiffness from nullable KilonewtonMetersPerRadian. - /// - public static RotationalStiffness? FromKilonewtonMetersPerRadian(QuantityValue? kilonewtonmetersperradian) - { - if (kilonewtonmetersperradian.HasValue) - { - return FromKilonewtonMetersPerRadian(kilonewtonmetersperradian.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalStiffness from nullable MeganewtonMetersPerRadian. - /// - public static RotationalStiffness? FromMeganewtonMetersPerRadian(QuantityValue? meganewtonmetersperradian) - { - if (meganewtonmetersperradian.HasValue) - { - return FromMeganewtonMetersPerRadian(meganewtonmetersperradian.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalStiffness from nullable NewtonMetersPerRadian. - /// - public static RotationalStiffness? FromNewtonMetersPerRadian(QuantityValue? newtonmetersperradian) - { - if (newtonmetersperradian.HasValue) - { - return FromNewtonMetersPerRadian(newtonmetersperradian.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static RotationalStiffness From(QuantityValue value, RotationalStiffnessU return new RotationalStiffness((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalStiffness unit value. - public static RotationalStiffness? From(QuantityValue? value, RotationalStiffnessUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new RotationalStiffness((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static RotationalStiffness operator -(RotationalStiffness right) - { - return new RotationalStiffness(-right.Value, right.Unit); - } - - public static RotationalStiffness operator +(RotationalStiffness left, RotationalStiffness right) - { - return new RotationalStiffness(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalStiffness operator -(RotationalStiffness left, RotationalStiffness right) - { - return new RotationalStiffness(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalStiffness operator *(double left, RotationalStiffness right) - { - return new RotationalStiffness(left * right.Value, right.Unit); - } - - public static RotationalStiffness operator *(RotationalStiffness left, double right) - { - return new RotationalStiffness(left.Value * right, left.Unit); - } - - public static RotationalStiffness operator /(RotationalStiffness left, double right) - { - return new RotationalStiffness(left.Value / right, left.Unit); - } - - public static double operator /(RotationalStiffness left, RotationalStiffness right) - { - return left.NewtonMetersPerRadian / right.NewtonMetersPerRadian; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(RotationalStiffness other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(RotationalStiffness left, RotationalStiffness right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(RotationalStiffness left, RotationalStiffness right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(RotationalStiffness left, RotationalStiffness right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(RotationalStiffness left, RotationalStiffness right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(RotationalStiffness left, RotationalStiffness right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(RotationalStiffness left, RotationalStiffness right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs index e2509b6516..e6aa05a26c 100644 --- a/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/RotationalStiffnessPerLength.g.cs @@ -215,54 +215,6 @@ public static RotationalStiffnessPerLength FromNewtonMetersPerRadianPerMeter(Qua return new RotationalStiffnessPerLength(value, RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable RotationalStiffnessPerLength from nullable KilonewtonMetersPerRadianPerMeter. - /// - public static RotationalStiffnessPerLength? FromKilonewtonMetersPerRadianPerMeter(QuantityValue? kilonewtonmetersperradianpermeter) - { - if (kilonewtonmetersperradianpermeter.HasValue) - { - return FromKilonewtonMetersPerRadianPerMeter(kilonewtonmetersperradianpermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalStiffnessPerLength from nullable MeganewtonMetersPerRadianPerMeter. - /// - public static RotationalStiffnessPerLength? FromMeganewtonMetersPerRadianPerMeter(QuantityValue? meganewtonmetersperradianpermeter) - { - if (meganewtonmetersperradianpermeter.HasValue) - { - return FromMeganewtonMetersPerRadianPerMeter(meganewtonmetersperradianpermeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable RotationalStiffnessPerLength from nullable NewtonMetersPerRadianPerMeter. - /// - public static RotationalStiffnessPerLength? FromNewtonMetersPerRadianPerMeter(QuantityValue? newtonmetersperradianpermeter) - { - if (newtonmetersperradianpermeter.HasValue) - { - return FromNewtonMetersPerRadianPerMeter(newtonmetersperradianpermeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -281,25 +233,6 @@ public static RotationalStiffnessPerLength From(QuantityValue value, RotationalS return new RotationalStiffnessPerLength((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// RotationalStiffnessPerLength unit value. - public static RotationalStiffnessPerLength? From(QuantityValue? value, RotationalStiffnessPerLengthUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new RotationalStiffnessPerLength((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -342,48 +275,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength right) - { - return new RotationalStiffnessPerLength(-right.Value, right.Unit); - } - - public static RotationalStiffnessPerLength operator +(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return new RotationalStiffnessPerLength(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalStiffnessPerLength operator -(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return new RotationalStiffnessPerLength(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static RotationalStiffnessPerLength operator *(double left, RotationalStiffnessPerLength right) - { - return new RotationalStiffnessPerLength(left * right.Value, right.Unit); - } - - public static RotationalStiffnessPerLength operator *(RotationalStiffnessPerLength left, double right) - { - return new RotationalStiffnessPerLength(left.Value * right, left.Unit); - } - - public static RotationalStiffnessPerLength operator /(RotationalStiffnessPerLength left, double right) - { - return new RotationalStiffnessPerLength(left.Value / right, left.Unit); - } - - public static double operator /(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return left.NewtonMetersPerRadianPerMeter / right.NewtonMetersPerRadianPerMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -405,43 +296,6 @@ int CompareTo(RotationalStiffnessPerLength other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(RotationalStiffnessPerLength left, RotationalStiffnessPerLength right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs index d1376ece5c..0d5a679e12 100644 --- a/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SolidAngle.g.cs @@ -169,24 +169,6 @@ public static SolidAngle FromSteradians(QuantityValue steradians) return new SolidAngle(value, SolidAngleUnit.Steradian); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SolidAngle from nullable Steradians. - /// - public static SolidAngle? FromSteradians(QuantityValue? steradians) - { - if (steradians.HasValue) - { - return FromSteradians(steradians.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -205,25 +187,6 @@ public static SolidAngle From(QuantityValue value, SolidAngleUnit fromUnit) return new SolidAngle((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SolidAngle unit value. - public static SolidAngle? From(QuantityValue? value, SolidAngleUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new SolidAngle((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -266,48 +229,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SolidAngle operator -(SolidAngle right) - { - return new SolidAngle(-right.Value, right.Unit); - } - - public static SolidAngle operator +(SolidAngle left, SolidAngle right) - { - return new SolidAngle(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SolidAngle operator -(SolidAngle left, SolidAngle right) - { - return new SolidAngle(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SolidAngle operator *(double left, SolidAngle right) - { - return new SolidAngle(left * right.Value, right.Unit); - } - - public static SolidAngle operator *(SolidAngle left, double right) - { - return new SolidAngle(left.Value * right, left.Unit); - } - - public static SolidAngle operator /(SolidAngle left, double right) - { - return new SolidAngle(left.Value / right, left.Unit); - } - - public static double operator /(SolidAngle left, SolidAngle right) - { - return left.Steradians / right.Steradians; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -329,43 +250,6 @@ int CompareTo(SolidAngle other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SolidAngle left, SolidAngle right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(SolidAngle left, SolidAngle right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(SolidAngle left, SolidAngle right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(SolidAngle left, SolidAngle right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(SolidAngle left, SolidAngle right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(SolidAngle left, SolidAngle right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs index 23e2eb41d9..faf974a8b7 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEnergy.g.cs @@ -305,129 +305,6 @@ public static SpecificEnergy FromWattHoursPerKilogram(QuantityValue watthoursper return new SpecificEnergy(value, SpecificEnergyUnit.WattHourPerKilogram); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SpecificEnergy from nullable CaloriesPerGram. - /// - public static SpecificEnergy? FromCaloriesPerGram(QuantityValue? caloriespergram) - { - if (caloriespergram.HasValue) - { - return FromCaloriesPerGram(caloriespergram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable JoulesPerKilogram. - /// - public static SpecificEnergy? FromJoulesPerKilogram(QuantityValue? joulesperkilogram) - { - if (joulesperkilogram.HasValue) - { - return FromJoulesPerKilogram(joulesperkilogram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable KilocaloriesPerGram. - /// - public static SpecificEnergy? FromKilocaloriesPerGram(QuantityValue? kilocaloriespergram) - { - if (kilocaloriespergram.HasValue) - { - return FromKilocaloriesPerGram(kilocaloriespergram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable KilojoulesPerKilogram. - /// - public static SpecificEnergy? FromKilojoulesPerKilogram(QuantityValue? kilojoulesperkilogram) - { - if (kilojoulesperkilogram.HasValue) - { - return FromKilojoulesPerKilogram(kilojoulesperkilogram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable KilowattHoursPerKilogram. - /// - public static SpecificEnergy? FromKilowattHoursPerKilogram(QuantityValue? kilowatthoursperkilogram) - { - if (kilowatthoursperkilogram.HasValue) - { - return FromKilowattHoursPerKilogram(kilowatthoursperkilogram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable MegajoulesPerKilogram. - /// - public static SpecificEnergy? FromMegajoulesPerKilogram(QuantityValue? megajoulesperkilogram) - { - if (megajoulesperkilogram.HasValue) - { - return FromMegajoulesPerKilogram(megajoulesperkilogram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable MegawattHoursPerKilogram. - /// - public static SpecificEnergy? FromMegawattHoursPerKilogram(QuantityValue? megawatthoursperkilogram) - { - if (megawatthoursperkilogram.HasValue) - { - return FromMegawattHoursPerKilogram(megawatthoursperkilogram.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEnergy from nullable WattHoursPerKilogram. - /// - public static SpecificEnergy? FromWattHoursPerKilogram(QuantityValue? watthoursperkilogram) - { - if (watthoursperkilogram.HasValue) - { - return FromWattHoursPerKilogram(watthoursperkilogram.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static SpecificEnergy From(QuantityValue value, SpecificEnergyUnit fromUn return new SpecificEnergy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificEnergy unit value. - public static SpecificEnergy? From(QuantityValue? value, SpecificEnergyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new SpecificEnergy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -507,48 +365,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SpecificEnergy operator -(SpecificEnergy right) - { - return new SpecificEnergy(-right.Value, right.Unit); - } - - public static SpecificEnergy operator +(SpecificEnergy left, SpecificEnergy right) - { - return new SpecificEnergy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificEnergy operator -(SpecificEnergy left, SpecificEnergy right) - { - return new SpecificEnergy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificEnergy operator *(double left, SpecificEnergy right) - { - return new SpecificEnergy(left * right.Value, right.Unit); - } - - public static SpecificEnergy operator *(SpecificEnergy left, double right) - { - return new SpecificEnergy(left.Value * right, left.Unit); - } - - public static SpecificEnergy operator /(SpecificEnergy left, double right) - { - return new SpecificEnergy(left.Value / right, left.Unit); - } - - public static double operator /(SpecificEnergy left, SpecificEnergy right) - { - return left.JoulesPerKilogram / right.JoulesPerKilogram; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -570,43 +386,6 @@ int CompareTo(SpecificEnergy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SpecificEnergy left, SpecificEnergy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(SpecificEnergy left, SpecificEnergy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(SpecificEnergy left, SpecificEnergy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(SpecificEnergy left, SpecificEnergy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(SpecificEnergy left, SpecificEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(SpecificEnergy left, SpecificEnergy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs index 94d81f0ea0..2d4f996481 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificEntropy.g.cs @@ -305,129 +305,6 @@ public static SpecificEntropy FromMegajoulesPerKilogramKelvin(QuantityValue mega return new SpecificEntropy(value, SpecificEntropyUnit.MegajoulePerKilogramKelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SpecificEntropy from nullable CaloriesPerGramKelvin. - /// - public static SpecificEntropy? FromCaloriesPerGramKelvin(QuantityValue? caloriespergramkelvin) - { - if (caloriespergramkelvin.HasValue) - { - return FromCaloriesPerGramKelvin(caloriespergramkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable JoulesPerKilogramDegreeCelsius. - /// - public static SpecificEntropy? FromJoulesPerKilogramDegreeCelsius(QuantityValue? joulesperkilogramdegreecelsius) - { - if (joulesperkilogramdegreecelsius.HasValue) - { - return FromJoulesPerKilogramDegreeCelsius(joulesperkilogramdegreecelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable JoulesPerKilogramKelvin. - /// - public static SpecificEntropy? FromJoulesPerKilogramKelvin(QuantityValue? joulesperkilogramkelvin) - { - if (joulesperkilogramkelvin.HasValue) - { - return FromJoulesPerKilogramKelvin(joulesperkilogramkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable KilocaloriesPerGramKelvin. - /// - public static SpecificEntropy? FromKilocaloriesPerGramKelvin(QuantityValue? kilocaloriespergramkelvin) - { - if (kilocaloriespergramkelvin.HasValue) - { - return FromKilocaloriesPerGramKelvin(kilocaloriespergramkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramDegreeCelsius. - /// - public static SpecificEntropy? FromKilojoulesPerKilogramDegreeCelsius(QuantityValue? kilojoulesperkilogramdegreecelsius) - { - if (kilojoulesperkilogramdegreecelsius.HasValue) - { - return FromKilojoulesPerKilogramDegreeCelsius(kilojoulesperkilogramdegreecelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable KilojoulesPerKilogramKelvin. - /// - public static SpecificEntropy? FromKilojoulesPerKilogramKelvin(QuantityValue? kilojoulesperkilogramkelvin) - { - if (kilojoulesperkilogramkelvin.HasValue) - { - return FromKilojoulesPerKilogramKelvin(kilojoulesperkilogramkelvin.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramDegreeCelsius. - /// - public static SpecificEntropy? FromMegajoulesPerKilogramDegreeCelsius(QuantityValue? megajoulesperkilogramdegreecelsius) - { - if (megajoulesperkilogramdegreecelsius.HasValue) - { - return FromMegajoulesPerKilogramDegreeCelsius(megajoulesperkilogramdegreecelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificEntropy from nullable MegajoulesPerKilogramKelvin. - /// - public static SpecificEntropy? FromMegajoulesPerKilogramKelvin(QuantityValue? megajoulesperkilogramkelvin) - { - if (megajoulesperkilogramkelvin.HasValue) - { - return FromMegajoulesPerKilogramKelvin(megajoulesperkilogramkelvin.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static SpecificEntropy From(QuantityValue value, SpecificEntropyUnit from return new SpecificEntropy((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificEntropy unit value. - public static SpecificEntropy? From(QuantityValue? value, SpecificEntropyUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new SpecificEntropy((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -507,48 +365,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SpecificEntropy operator -(SpecificEntropy right) - { - return new SpecificEntropy(-right.Value, right.Unit); - } - - public static SpecificEntropy operator +(SpecificEntropy left, SpecificEntropy right) - { - return new SpecificEntropy(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificEntropy operator -(SpecificEntropy left, SpecificEntropy right) - { - return new SpecificEntropy(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificEntropy operator *(double left, SpecificEntropy right) - { - return new SpecificEntropy(left * right.Value, right.Unit); - } - - public static SpecificEntropy operator *(SpecificEntropy left, double right) - { - return new SpecificEntropy(left.Value * right, left.Unit); - } - - public static SpecificEntropy operator /(SpecificEntropy left, double right) - { - return new SpecificEntropy(left.Value / right, left.Unit); - } - - public static double operator /(SpecificEntropy left, SpecificEntropy right) - { - return left.JoulesPerKilogramKelvin / right.JoulesPerKilogramKelvin; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -570,43 +386,6 @@ int CompareTo(SpecificEntropy other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SpecificEntropy left, SpecificEntropy right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(SpecificEntropy left, SpecificEntropy right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(SpecificEntropy left, SpecificEntropy right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(SpecificEntropy left, SpecificEntropy right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(SpecificEntropy left, SpecificEntropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(SpecificEntropy left, SpecificEntropy right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs index 74d04c39c2..bbabc4b6e2 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificVolume.g.cs @@ -179,24 +179,6 @@ public static SpecificVolume FromCubicMetersPerKilogram(QuantityValue cubicmeter return new SpecificVolume(value, SpecificVolumeUnit.CubicMeterPerKilogram); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SpecificVolume from nullable CubicMetersPerKilogram. - /// - public static SpecificVolume? FromCubicMetersPerKilogram(QuantityValue? cubicmetersperkilogram) - { - if (cubicmetersperkilogram.HasValue) - { - return FromCubicMetersPerKilogram(cubicmetersperkilogram.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -215,25 +197,6 @@ public static SpecificVolume From(QuantityValue value, SpecificVolumeUnit fromUn return new SpecificVolume((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificVolume unit value. - public static SpecificVolume? From(QuantityValue? value, SpecificVolumeUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new SpecificVolume((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -276,48 +239,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SpecificVolume operator -(SpecificVolume right) - { - return new SpecificVolume(-right.Value, right.Unit); - } - - public static SpecificVolume operator +(SpecificVolume left, SpecificVolume right) - { - return new SpecificVolume(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificVolume operator -(SpecificVolume left, SpecificVolume right) - { - return new SpecificVolume(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificVolume operator *(double left, SpecificVolume right) - { - return new SpecificVolume(left * right.Value, right.Unit); - } - - public static SpecificVolume operator *(SpecificVolume left, double right) - { - return new SpecificVolume(left.Value * right, left.Unit); - } - - public static SpecificVolume operator /(SpecificVolume left, double right) - { - return new SpecificVolume(left.Value / right, left.Unit); - } - - public static double operator /(SpecificVolume left, SpecificVolume right) - { - return left.CubicMetersPerKilogram / right.CubicMetersPerKilogram; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -339,43 +260,6 @@ int CompareTo(SpecificVolume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SpecificVolume left, SpecificVolume right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(SpecificVolume left, SpecificVolume right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(SpecificVolume left, SpecificVolume right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(SpecificVolume left, SpecificVolume right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(SpecificVolume left, SpecificVolume right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(SpecificVolume left, SpecificVolume right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs index fe455c3c83..6a93542363 100644 --- a/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/SpecificWeight.g.cs @@ -467,264 +467,6 @@ public static SpecificWeight FromTonnesForcePerCubicMillimeter(QuantityValue ton return new SpecificWeight(value, SpecificWeightUnit.TonneForcePerCubicMillimeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicCentimeter. - /// - public static SpecificWeight? FromKilogramsForcePerCubicCentimeter(QuantityValue? kilogramsforcepercubiccentimeter) - { - if (kilogramsforcepercubiccentimeter.HasValue) - { - return FromKilogramsForcePerCubicCentimeter(kilogramsforcepercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMeter. - /// - public static SpecificWeight? FromKilogramsForcePerCubicMeter(QuantityValue? kilogramsforcepercubicmeter) - { - if (kilogramsforcepercubicmeter.HasValue) - { - return FromKilogramsForcePerCubicMeter(kilogramsforcepercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilogramsForcePerCubicMillimeter. - /// - public static SpecificWeight? FromKilogramsForcePerCubicMillimeter(QuantityValue? kilogramsforcepercubicmillimeter) - { - if (kilogramsforcepercubicmillimeter.HasValue) - { - return FromKilogramsForcePerCubicMillimeter(kilogramsforcepercubicmillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicCentimeter. - /// - public static SpecificWeight? FromKilonewtonsPerCubicCentimeter(QuantityValue? kilonewtonspercubiccentimeter) - { - if (kilonewtonspercubiccentimeter.HasValue) - { - return FromKilonewtonsPerCubicCentimeter(kilonewtonspercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMeter. - /// - public static SpecificWeight? FromKilonewtonsPerCubicMeter(QuantityValue? kilonewtonspercubicmeter) - { - if (kilonewtonspercubicmeter.HasValue) - { - return FromKilonewtonsPerCubicMeter(kilonewtonspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilonewtonsPerCubicMillimeter. - /// - public static SpecificWeight? FromKilonewtonsPerCubicMillimeter(QuantityValue? kilonewtonspercubicmillimeter) - { - if (kilonewtonspercubicmillimeter.HasValue) - { - return FromKilonewtonsPerCubicMillimeter(kilonewtonspercubicmillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicFoot. - /// - public static SpecificWeight? FromKilopoundsForcePerCubicFoot(QuantityValue? kilopoundsforcepercubicfoot) - { - if (kilopoundsforcepercubicfoot.HasValue) - { - return FromKilopoundsForcePerCubicFoot(kilopoundsforcepercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable KilopoundsForcePerCubicInch. - /// - public static SpecificWeight? FromKilopoundsForcePerCubicInch(QuantityValue? kilopoundsforcepercubicinch) - { - if (kilopoundsforcepercubicinch.HasValue) - { - return FromKilopoundsForcePerCubicInch(kilopoundsforcepercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable MeganewtonsPerCubicMeter. - /// - public static SpecificWeight? FromMeganewtonsPerCubicMeter(QuantityValue? meganewtonspercubicmeter) - { - if (meganewtonspercubicmeter.HasValue) - { - return FromMeganewtonsPerCubicMeter(meganewtonspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicCentimeter. - /// - public static SpecificWeight? FromNewtonsPerCubicCentimeter(QuantityValue? newtonspercubiccentimeter) - { - if (newtonspercubiccentimeter.HasValue) - { - return FromNewtonsPerCubicCentimeter(newtonspercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicMeter. - /// - public static SpecificWeight? FromNewtonsPerCubicMeter(QuantityValue? newtonspercubicmeter) - { - if (newtonspercubicmeter.HasValue) - { - return FromNewtonsPerCubicMeter(newtonspercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable NewtonsPerCubicMillimeter. - /// - public static SpecificWeight? FromNewtonsPerCubicMillimeter(QuantityValue? newtonspercubicmillimeter) - { - if (newtonspercubicmillimeter.HasValue) - { - return FromNewtonsPerCubicMillimeter(newtonspercubicmillimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable PoundsForcePerCubicFoot. - /// - public static SpecificWeight? FromPoundsForcePerCubicFoot(QuantityValue? poundsforcepercubicfoot) - { - if (poundsforcepercubicfoot.HasValue) - { - return FromPoundsForcePerCubicFoot(poundsforcepercubicfoot.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable PoundsForcePerCubicInch. - /// - public static SpecificWeight? FromPoundsForcePerCubicInch(QuantityValue? poundsforcepercubicinch) - { - if (poundsforcepercubicinch.HasValue) - { - return FromPoundsForcePerCubicInch(poundsforcepercubicinch.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicCentimeter. - /// - public static SpecificWeight? FromTonnesForcePerCubicCentimeter(QuantityValue? tonnesforcepercubiccentimeter) - { - if (tonnesforcepercubiccentimeter.HasValue) - { - return FromTonnesForcePerCubicCentimeter(tonnesforcepercubiccentimeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMeter. - /// - public static SpecificWeight? FromTonnesForcePerCubicMeter(QuantityValue? tonnesforcepercubicmeter) - { - if (tonnesforcepercubicmeter.HasValue) - { - return FromTonnesForcePerCubicMeter(tonnesforcepercubicmeter.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable SpecificWeight from nullable TonnesForcePerCubicMillimeter. - /// - public static SpecificWeight? FromTonnesForcePerCubicMillimeter(QuantityValue? tonnesforcepercubicmillimeter) - { - if (tonnesforcepercubicmillimeter.HasValue) - { - return FromTonnesForcePerCubicMillimeter(tonnesforcepercubicmillimeter.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -743,25 +485,6 @@ public static SpecificWeight From(QuantityValue value, SpecificWeightUnit fromUn return new SpecificWeight((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// SpecificWeight unit value. - public static SpecificWeight? From(QuantityValue? value, SpecificWeightUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new SpecificWeight((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -804,48 +527,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static SpecificWeight operator -(SpecificWeight right) - { - return new SpecificWeight(-right.Value, right.Unit); - } - - public static SpecificWeight operator +(SpecificWeight left, SpecificWeight right) - { - return new SpecificWeight(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificWeight operator -(SpecificWeight left, SpecificWeight right) - { - return new SpecificWeight(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static SpecificWeight operator *(double left, SpecificWeight right) - { - return new SpecificWeight(left * right.Value, right.Unit); - } - - public static SpecificWeight operator *(SpecificWeight left, double right) - { - return new SpecificWeight(left.Value * right, left.Unit); - } - - public static SpecificWeight operator /(SpecificWeight left, double right) - { - return new SpecificWeight(left.Value / right, left.Unit); - } - - public static double operator /(SpecificWeight left, SpecificWeight right) - { - return left.NewtonsPerCubicMeter / right.NewtonsPerCubicMeter; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -867,43 +548,6 @@ int CompareTo(SpecificWeight other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(SpecificWeight left, SpecificWeight right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(SpecificWeight left, SpecificWeight right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(SpecificWeight left, SpecificWeight right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(SpecificWeight left, SpecificWeight right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(SpecificWeight left, SpecificWeight right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(SpecificWeight left, SpecificWeight right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs index 8a233d9dbe..74b6d36624 100644 --- a/UnitsNet/GeneratedCode/Quantities/Speed.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Speed.g.cs @@ -737,489 +737,6 @@ public static Speed FromYardsPerSecond(QuantityValue yardspersecond) return new Speed(value, SpeedUnit.YardPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Speed from nullable CentimetersPerHour. - /// - public static Speed? FromCentimetersPerHour(QuantityValue? centimetersperhour) - { - if (centimetersperhour.HasValue) - { - return FromCentimetersPerHour(centimetersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable CentimetersPerMinutes. - /// - public static Speed? FromCentimetersPerMinutes(QuantityValue? centimetersperminutes) - { - if (centimetersperminutes.HasValue) - { - return FromCentimetersPerMinutes(centimetersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable CentimetersPerSecond. - /// - public static Speed? FromCentimetersPerSecond(QuantityValue? centimeterspersecond) - { - if (centimeterspersecond.HasValue) - { - return FromCentimetersPerSecond(centimeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable DecimetersPerMinutes. - /// - public static Speed? FromDecimetersPerMinutes(QuantityValue? decimetersperminutes) - { - if (decimetersperminutes.HasValue) - { - return FromDecimetersPerMinutes(decimetersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable DecimetersPerSecond. - /// - public static Speed? FromDecimetersPerSecond(QuantityValue? decimeterspersecond) - { - if (decimeterspersecond.HasValue) - { - return FromDecimetersPerSecond(decimeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable FeetPerHour. - /// - public static Speed? FromFeetPerHour(QuantityValue? feetperhour) - { - if (feetperhour.HasValue) - { - return FromFeetPerHour(feetperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable FeetPerMinute. - /// - public static Speed? FromFeetPerMinute(QuantityValue? feetperminute) - { - if (feetperminute.HasValue) - { - return FromFeetPerMinute(feetperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable FeetPerSecond. - /// - public static Speed? FromFeetPerSecond(QuantityValue? feetpersecond) - { - if (feetpersecond.HasValue) - { - return FromFeetPerSecond(feetpersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable InchesPerHour. - /// - public static Speed? FromInchesPerHour(QuantityValue? inchesperhour) - { - if (inchesperhour.HasValue) - { - return FromInchesPerHour(inchesperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable InchesPerMinute. - /// - public static Speed? FromInchesPerMinute(QuantityValue? inchesperminute) - { - if (inchesperminute.HasValue) - { - return FromInchesPerMinute(inchesperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable InchesPerSecond. - /// - public static Speed? FromInchesPerSecond(QuantityValue? inchespersecond) - { - if (inchespersecond.HasValue) - { - return FromInchesPerSecond(inchespersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable KilometersPerHour. - /// - public static Speed? FromKilometersPerHour(QuantityValue? kilometersperhour) - { - if (kilometersperhour.HasValue) - { - return FromKilometersPerHour(kilometersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable KilometersPerMinutes. - /// - public static Speed? FromKilometersPerMinutes(QuantityValue? kilometersperminutes) - { - if (kilometersperminutes.HasValue) - { - return FromKilometersPerMinutes(kilometersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable KilometersPerSecond. - /// - public static Speed? FromKilometersPerSecond(QuantityValue? kilometerspersecond) - { - if (kilometerspersecond.HasValue) - { - return FromKilometersPerSecond(kilometerspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable Knots. - /// - public static Speed? FromKnots(QuantityValue? knots) - { - if (knots.HasValue) - { - return FromKnots(knots.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MetersPerHour. - /// - public static Speed? FromMetersPerHour(QuantityValue? metersperhour) - { - if (metersperhour.HasValue) - { - return FromMetersPerHour(metersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MetersPerMinutes. - /// - public static Speed? FromMetersPerMinutes(QuantityValue? metersperminutes) - { - if (metersperminutes.HasValue) - { - return FromMetersPerMinutes(metersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MetersPerSecond. - /// - public static Speed? FromMetersPerSecond(QuantityValue? meterspersecond) - { - if (meterspersecond.HasValue) - { - return FromMetersPerSecond(meterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MicrometersPerMinutes. - /// - public static Speed? FromMicrometersPerMinutes(QuantityValue? micrometersperminutes) - { - if (micrometersperminutes.HasValue) - { - return FromMicrometersPerMinutes(micrometersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MicrometersPerSecond. - /// - public static Speed? FromMicrometersPerSecond(QuantityValue? micrometerspersecond) - { - if (micrometerspersecond.HasValue) - { - return FromMicrometersPerSecond(micrometerspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MilesPerHour. - /// - public static Speed? FromMilesPerHour(QuantityValue? milesperhour) - { - if (milesperhour.HasValue) - { - return FromMilesPerHour(milesperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MillimetersPerHour. - /// - public static Speed? FromMillimetersPerHour(QuantityValue? millimetersperhour) - { - if (millimetersperhour.HasValue) - { - return FromMillimetersPerHour(millimetersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MillimetersPerMinutes. - /// - public static Speed? FromMillimetersPerMinutes(QuantityValue? millimetersperminutes) - { - if (millimetersperminutes.HasValue) - { - return FromMillimetersPerMinutes(millimetersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable MillimetersPerSecond. - /// - public static Speed? FromMillimetersPerSecond(QuantityValue? millimeterspersecond) - { - if (millimeterspersecond.HasValue) - { - return FromMillimetersPerSecond(millimeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable NanometersPerMinutes. - /// - public static Speed? FromNanometersPerMinutes(QuantityValue? nanometersperminutes) - { - if (nanometersperminutes.HasValue) - { - return FromNanometersPerMinutes(nanometersperminutes.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable NanometersPerSecond. - /// - public static Speed? FromNanometersPerSecond(QuantityValue? nanometerspersecond) - { - if (nanometerspersecond.HasValue) - { - return FromNanometersPerSecond(nanometerspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerHour. - /// - public static Speed? FromUsSurveyFeetPerHour(QuantityValue? ussurveyfeetperhour) - { - if (ussurveyfeetperhour.HasValue) - { - return FromUsSurveyFeetPerHour(ussurveyfeetperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerMinute. - /// - public static Speed? FromUsSurveyFeetPerMinute(QuantityValue? ussurveyfeetperminute) - { - if (ussurveyfeetperminute.HasValue) - { - return FromUsSurveyFeetPerMinute(ussurveyfeetperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable UsSurveyFeetPerSecond. - /// - public static Speed? FromUsSurveyFeetPerSecond(QuantityValue? ussurveyfeetpersecond) - { - if (ussurveyfeetpersecond.HasValue) - { - return FromUsSurveyFeetPerSecond(ussurveyfeetpersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable YardsPerHour. - /// - public static Speed? FromYardsPerHour(QuantityValue? yardsperhour) - { - if (yardsperhour.HasValue) - { - return FromYardsPerHour(yardsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable YardsPerMinute. - /// - public static Speed? FromYardsPerMinute(QuantityValue? yardsperminute) - { - if (yardsperminute.HasValue) - { - return FromYardsPerMinute(yardsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Speed from nullable YardsPerSecond. - /// - public static Speed? FromYardsPerSecond(QuantityValue? yardspersecond) - { - if (yardspersecond.HasValue) - { - return FromYardsPerSecond(yardspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1238,25 +755,6 @@ public static Speed From(QuantityValue value, SpeedUnit fromUnit) return new Speed((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Speed unit value. - public static Speed? From(QuantityValue? value, SpeedUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Speed((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1299,48 +797,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Speed operator -(Speed right) - { - return new Speed(-right.Value, right.Unit); - } - - public static Speed operator +(Speed left, Speed right) - { - return new Speed(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Speed operator -(Speed left, Speed right) - { - return new Speed(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Speed operator *(double left, Speed right) - { - return new Speed(left * right.Value, right.Unit); - } - - public static Speed operator *(Speed left, double right) - { - return new Speed(left.Value * right, left.Unit); - } - - public static Speed operator /(Speed left, double right) - { - return new Speed(left.Value / right, left.Unit); - } - - public static double operator /(Speed left, Speed right) - { - return left.MetersPerSecond / right.MetersPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1362,43 +818,6 @@ int CompareTo(Speed other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Speed left, Speed right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Speed left, Speed right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Speed left, Speed right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Speed left, Speed right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Speed left, Speed right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Speed left, Speed right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs index ef70148d82..4c9b830843 100644 --- a/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Temperature.g.cs @@ -305,129 +305,6 @@ public static Temperature FromKelvins(QuantityValue kelvins) return new Temperature(value, TemperatureUnit.Kelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Temperature from nullable DegreesCelsius. - /// - public static Temperature? FromDegreesCelsius(QuantityValue? degreescelsius) - { - if (degreescelsius.HasValue) - { - return FromDegreesCelsius(degreescelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesDelisle. - /// - public static Temperature? FromDegreesDelisle(QuantityValue? degreesdelisle) - { - if (degreesdelisle.HasValue) - { - return FromDegreesDelisle(degreesdelisle.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesFahrenheit. - /// - public static Temperature? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) - { - if (degreesfahrenheit.HasValue) - { - return FromDegreesFahrenheit(degreesfahrenheit.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesNewton. - /// - public static Temperature? FromDegreesNewton(QuantityValue? degreesnewton) - { - if (degreesnewton.HasValue) - { - return FromDegreesNewton(degreesnewton.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesRankine. - /// - public static Temperature? FromDegreesRankine(QuantityValue? degreesrankine) - { - if (degreesrankine.HasValue) - { - return FromDegreesRankine(degreesrankine.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesReaumur. - /// - public static Temperature? FromDegreesReaumur(QuantityValue? degreesreaumur) - { - if (degreesreaumur.HasValue) - { - return FromDegreesReaumur(degreesreaumur.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable DegreesRoemer. - /// - public static Temperature? FromDegreesRoemer(QuantityValue? degreesroemer) - { - if (degreesroemer.HasValue) - { - return FromDegreesRoemer(degreesroemer.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Temperature from nullable Kelvins. - /// - public static Temperature? FromKelvins(QuantityValue? kelvins) - { - if (kelvins.HasValue) - { - return FromKelvins(kelvins.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -446,25 +323,6 @@ public static Temperature From(QuantityValue value, TemperatureUnit fromUnit) return new Temperature((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Temperature unit value. - public static Temperature? From(QuantityValue? value, TemperatureUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Temperature((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -528,43 +386,6 @@ int CompareTo(Temperature other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Temperature left, Temperature right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Temperature left, Temperature right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Temperature left, Temperature right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Temperature left, Temperature right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Temperature left, Temperature right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Temperature left, Temperature right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs index f67a8206b2..82a81a1e5e 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureChangeRate.g.cs @@ -341,159 +341,6 @@ public static TemperatureChangeRate FromNanodegreesCelsiusPerSecond(QuantityValu return new TemperatureChangeRate(value, TemperatureChangeRateUnit.NanodegreeCelsiusPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable TemperatureChangeRate from nullable CentidegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromCentidegreesCelsiusPerSecond(QuantityValue? centidegreescelsiuspersecond) - { - if (centidegreescelsiuspersecond.HasValue) - { - return FromCentidegreesCelsiusPerSecond(centidegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable DecadegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromDecadegreesCelsiusPerSecond(QuantityValue? decadegreescelsiuspersecond) - { - if (decadegreescelsiuspersecond.HasValue) - { - return FromDecadegreesCelsiusPerSecond(decadegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable DecidegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromDecidegreesCelsiusPerSecond(QuantityValue? decidegreescelsiuspersecond) - { - if (decidegreescelsiuspersecond.HasValue) - { - return FromDecidegreesCelsiusPerSecond(decidegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerMinute. - /// - public static TemperatureChangeRate? FromDegreesCelsiusPerMinute(QuantityValue? degreescelsiusperminute) - { - if (degreescelsiusperminute.HasValue) - { - return FromDegreesCelsiusPerMinute(degreescelsiusperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable DegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromDegreesCelsiusPerSecond(QuantityValue? degreescelsiuspersecond) - { - if (degreescelsiuspersecond.HasValue) - { - return FromDegreesCelsiusPerSecond(degreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable HectodegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromHectodegreesCelsiusPerSecond(QuantityValue? hectodegreescelsiuspersecond) - { - if (hectodegreescelsiuspersecond.HasValue) - { - return FromHectodegreesCelsiusPerSecond(hectodegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable KilodegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromKilodegreesCelsiusPerSecond(QuantityValue? kilodegreescelsiuspersecond) - { - if (kilodegreescelsiuspersecond.HasValue) - { - return FromKilodegreesCelsiusPerSecond(kilodegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable MicrodegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromMicrodegreesCelsiusPerSecond(QuantityValue? microdegreescelsiuspersecond) - { - if (microdegreescelsiuspersecond.HasValue) - { - return FromMicrodegreesCelsiusPerSecond(microdegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable MillidegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromMillidegreesCelsiusPerSecond(QuantityValue? millidegreescelsiuspersecond) - { - if (millidegreescelsiuspersecond.HasValue) - { - return FromMillidegreesCelsiusPerSecond(millidegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureChangeRate from nullable NanodegreesCelsiusPerSecond. - /// - public static TemperatureChangeRate? FromNanodegreesCelsiusPerSecond(QuantityValue? nanodegreescelsiuspersecond) - { - if (nanodegreescelsiuspersecond.HasValue) - { - return FromNanodegreesCelsiusPerSecond(nanodegreescelsiuspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -512,25 +359,6 @@ public static TemperatureChangeRate From(QuantityValue value, TemperatureChangeR return new TemperatureChangeRate((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// TemperatureChangeRate unit value. - public static TemperatureChangeRate? From(QuantityValue? value, TemperatureChangeRateUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new TemperatureChangeRate((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -573,48 +401,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static TemperatureChangeRate operator -(TemperatureChangeRate right) - { - return new TemperatureChangeRate(-right.Value, right.Unit); - } - - public static TemperatureChangeRate operator +(TemperatureChangeRate left, TemperatureChangeRate right) - { - return new TemperatureChangeRate(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static TemperatureChangeRate operator -(TemperatureChangeRate left, TemperatureChangeRate right) - { - return new TemperatureChangeRate(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static TemperatureChangeRate operator *(double left, TemperatureChangeRate right) - { - return new TemperatureChangeRate(left * right.Value, right.Unit); - } - - public static TemperatureChangeRate operator *(TemperatureChangeRate left, double right) - { - return new TemperatureChangeRate(left.Value * right, left.Unit); - } - - public static TemperatureChangeRate operator /(TemperatureChangeRate left, double right) - { - return new TemperatureChangeRate(left.Value / right, left.Unit); - } - - public static double operator /(TemperatureChangeRate left, TemperatureChangeRate right) - { - return left.DegreesCelsiusPerSecond / right.DegreesCelsiusPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -636,43 +422,6 @@ int CompareTo(TemperatureChangeRate other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(TemperatureChangeRate left, TemperatureChangeRate right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(TemperatureChangeRate left, TemperatureChangeRate right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(TemperatureChangeRate left, TemperatureChangeRate right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(TemperatureChangeRate left, TemperatureChangeRate right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(TemperatureChangeRate left, TemperatureChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(TemperatureChangeRate left, TemperatureChangeRate right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs index 7c0b46a212..c0874d6b9d 100644 --- a/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/TemperatureDelta.g.cs @@ -447,249 +447,6 @@ public static TemperatureDelta FromKelvinsDelta(QuantityValue kelvinsdelta) return new TemperatureDelta(value, TemperatureDeltaUnit.KelvinDelta); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable TemperatureDelta from nullable DegreesCelsius. - /// - public static TemperatureDelta? FromDegreesCelsius(QuantityValue? degreescelsius) - { - if (degreescelsius.HasValue) - { - return FromDegreesCelsius(degreescelsius.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesCelsiusDelta. - /// - public static TemperatureDelta? FromDegreesCelsiusDelta(QuantityValue? degreescelsiusdelta) - { - if (degreescelsiusdelta.HasValue) - { - return FromDegreesCelsiusDelta(degreescelsiusdelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesDelisle. - /// - public static TemperatureDelta? FromDegreesDelisle(QuantityValue? degreesdelisle) - { - if (degreesdelisle.HasValue) - { - return FromDegreesDelisle(degreesdelisle.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesDelisleDelta. - /// - public static TemperatureDelta? FromDegreesDelisleDelta(QuantityValue? degreesdelisledelta) - { - if (degreesdelisledelta.HasValue) - { - return FromDegreesDelisleDelta(degreesdelisledelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesFahrenheit. - /// - public static TemperatureDelta? FromDegreesFahrenheit(QuantityValue? degreesfahrenheit) - { - if (degreesfahrenheit.HasValue) - { - return FromDegreesFahrenheit(degreesfahrenheit.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesFahrenheitDelta. - /// - public static TemperatureDelta? FromDegreesFahrenheitDelta(QuantityValue? degreesfahrenheitdelta) - { - if (degreesfahrenheitdelta.HasValue) - { - return FromDegreesFahrenheitDelta(degreesfahrenheitdelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesNewton. - /// - public static TemperatureDelta? FromDegreesNewton(QuantityValue? degreesnewton) - { - if (degreesnewton.HasValue) - { - return FromDegreesNewton(degreesnewton.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesNewtonDelta. - /// - public static TemperatureDelta? FromDegreesNewtonDelta(QuantityValue? degreesnewtondelta) - { - if (degreesnewtondelta.HasValue) - { - return FromDegreesNewtonDelta(degreesnewtondelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRankine. - /// - public static TemperatureDelta? FromDegreesRankine(QuantityValue? degreesrankine) - { - if (degreesrankine.HasValue) - { - return FromDegreesRankine(degreesrankine.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRankineDelta. - /// - public static TemperatureDelta? FromDegreesRankineDelta(QuantityValue? degreesrankinedelta) - { - if (degreesrankinedelta.HasValue) - { - return FromDegreesRankineDelta(degreesrankinedelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesReaumur. - /// - public static TemperatureDelta? FromDegreesReaumur(QuantityValue? degreesreaumur) - { - if (degreesreaumur.HasValue) - { - return FromDegreesReaumur(degreesreaumur.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesReaumurDelta. - /// - public static TemperatureDelta? FromDegreesReaumurDelta(QuantityValue? degreesreaumurdelta) - { - if (degreesreaumurdelta.HasValue) - { - return FromDegreesReaumurDelta(degreesreaumurdelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRoemer. - /// - public static TemperatureDelta? FromDegreesRoemer(QuantityValue? degreesroemer) - { - if (degreesroemer.HasValue) - { - return FromDegreesRoemer(degreesroemer.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable DegreesRoemerDelta. - /// - public static TemperatureDelta? FromDegreesRoemerDelta(QuantityValue? degreesroemerdelta) - { - if (degreesroemerdelta.HasValue) - { - return FromDegreesRoemerDelta(degreesroemerdelta.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable Kelvins. - /// - public static TemperatureDelta? FromKelvins(QuantityValue? kelvins) - { - if (kelvins.HasValue) - { - return FromKelvins(kelvins.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable TemperatureDelta from nullable KelvinsDelta. - /// - public static TemperatureDelta? FromKelvinsDelta(QuantityValue? kelvinsdelta) - { - if (kelvinsdelta.HasValue) - { - return FromKelvinsDelta(kelvinsdelta.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -708,25 +465,6 @@ public static TemperatureDelta From(QuantityValue value, TemperatureDeltaUnit fr return new TemperatureDelta((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// TemperatureDelta unit value. - public static TemperatureDelta? From(QuantityValue? value, TemperatureDeltaUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new TemperatureDelta((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -769,48 +507,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static TemperatureDelta operator -(TemperatureDelta right) - { - return new TemperatureDelta(-right.Value, right.Unit); - } - - public static TemperatureDelta operator +(TemperatureDelta left, TemperatureDelta right) - { - return new TemperatureDelta(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static TemperatureDelta operator -(TemperatureDelta left, TemperatureDelta right) - { - return new TemperatureDelta(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static TemperatureDelta operator *(double left, TemperatureDelta right) - { - return new TemperatureDelta(left * right.Value, right.Unit); - } - - public static TemperatureDelta operator *(TemperatureDelta left, double right) - { - return new TemperatureDelta(left.Value * right, left.Unit); - } - - public static TemperatureDelta operator /(TemperatureDelta left, double right) - { - return new TemperatureDelta(left.Value / right, left.Unit); - } - - public static double operator /(TemperatureDelta left, TemperatureDelta right) - { - return left.Kelvins / right.Kelvins; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -832,43 +528,6 @@ int CompareTo(TemperatureDelta other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(TemperatureDelta left, TemperatureDelta right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(TemperatureDelta left, TemperatureDelta right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(TemperatureDelta left, TemperatureDelta right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(TemperatureDelta left, TemperatureDelta right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(TemperatureDelta left, TemperatureDelta right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(TemperatureDelta left, TemperatureDelta right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs index 6265198b76..32759c93d1 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalConductivity.g.cs @@ -197,39 +197,6 @@ public static ThermalConductivity FromWattsPerMeterKelvin(QuantityValue wattsper return new ThermalConductivity(value, ThermalConductivityUnit.WattPerMeterKelvin); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ThermalConductivity from nullable BtusPerHourFootFahrenheit. - /// - public static ThermalConductivity? FromBtusPerHourFootFahrenheit(QuantityValue? btusperhourfootfahrenheit) - { - if (btusperhourfootfahrenheit.HasValue) - { - return FromBtusPerHourFootFahrenheit(btusperhourfootfahrenheit.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ThermalConductivity from nullable WattsPerMeterKelvin. - /// - public static ThermalConductivity? FromWattsPerMeterKelvin(QuantityValue? wattspermeterkelvin) - { - if (wattspermeterkelvin.HasValue) - { - return FromWattsPerMeterKelvin(wattspermeterkelvin.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -248,25 +215,6 @@ public static ThermalConductivity From(QuantityValue value, ThermalConductivityU return new ThermalConductivity((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ThermalConductivity unit value. - public static ThermalConductivity? From(QuantityValue? value, ThermalConductivityUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ThermalConductivity((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -309,48 +257,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ThermalConductivity operator -(ThermalConductivity right) - { - return new ThermalConductivity(-right.Value, right.Unit); - } - - public static ThermalConductivity operator +(ThermalConductivity left, ThermalConductivity right) - { - return new ThermalConductivity(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ThermalConductivity operator -(ThermalConductivity left, ThermalConductivity right) - { - return new ThermalConductivity(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ThermalConductivity operator *(double left, ThermalConductivity right) - { - return new ThermalConductivity(left * right.Value, right.Unit); - } - - public static ThermalConductivity operator *(ThermalConductivity left, double right) - { - return new ThermalConductivity(left.Value * right, left.Unit); - } - - public static ThermalConductivity operator /(ThermalConductivity left, double right) - { - return new ThermalConductivity(left.Value / right, left.Unit); - } - - public static double operator /(ThermalConductivity left, ThermalConductivity right) - { - return left.WattsPerMeterKelvin / right.WattsPerMeterKelvin; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -372,43 +278,6 @@ int CompareTo(ThermalConductivity other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ThermalConductivity left, ThermalConductivity right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ThermalConductivity left, ThermalConductivity right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ThermalConductivity left, ThermalConductivity right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ThermalConductivity left, ThermalConductivity right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ThermalConductivity left, ThermalConductivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ThermalConductivity left, ThermalConductivity right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs index cace0781e7..1ae586b2ce 100644 --- a/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/ThermalResistance.g.cs @@ -251,84 +251,6 @@ public static ThermalResistance FromSquareMeterKelvinsPerKilowatt(QuantityValue return new ThermalResistance(value, ThermalResistanceUnit.SquareMeterKelvinPerKilowatt); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable ThermalResistance from nullable HourSquareFeetDegreesFahrenheitPerBtu. - /// - public static ThermalResistance? FromHourSquareFeetDegreesFahrenheitPerBtu(QuantityValue? hoursquarefeetdegreesfahrenheitperbtu) - { - if (hoursquarefeetdegreesfahrenheitperbtu.HasValue) - { - return FromHourSquareFeetDegreesFahrenheitPerBtu(hoursquarefeetdegreesfahrenheitperbtu.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ThermalResistance from nullable SquareCentimeterHourDegreesCelsiusPerKilocalorie. - /// - public static ThermalResistance? FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(QuantityValue? squarecentimeterhourdegreescelsiusperkilocalorie) - { - if (squarecentimeterhourdegreescelsiusperkilocalorie.HasValue) - { - return FromSquareCentimeterHourDegreesCelsiusPerKilocalorie(squarecentimeterhourdegreescelsiusperkilocalorie.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ThermalResistance from nullable SquareCentimeterKelvinsPerWatt. - /// - public static ThermalResistance? FromSquareCentimeterKelvinsPerWatt(QuantityValue? squarecentimeterkelvinsperwatt) - { - if (squarecentimeterkelvinsperwatt.HasValue) - { - return FromSquareCentimeterKelvinsPerWatt(squarecentimeterkelvinsperwatt.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ThermalResistance from nullable SquareMeterDegreesCelsiusPerWatt. - /// - public static ThermalResistance? FromSquareMeterDegreesCelsiusPerWatt(QuantityValue? squaremeterdegreescelsiusperwatt) - { - if (squaremeterdegreescelsiusperwatt.HasValue) - { - return FromSquareMeterDegreesCelsiusPerWatt(squaremeterdegreescelsiusperwatt.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable ThermalResistance from nullable SquareMeterKelvinsPerKilowatt. - /// - public static ThermalResistance? FromSquareMeterKelvinsPerKilowatt(QuantityValue? squaremeterkelvinsperkilowatt) - { - if (squaremeterkelvinsperkilowatt.HasValue) - { - return FromSquareMeterKelvinsPerKilowatt(squaremeterkelvinsperkilowatt.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -347,25 +269,6 @@ public static ThermalResistance From(QuantityValue value, ThermalResistanceUnit return new ThermalResistance((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// ThermalResistance unit value. - public static ThermalResistance? From(QuantityValue? value, ThermalResistanceUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new ThermalResistance((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -408,48 +311,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static ThermalResistance operator -(ThermalResistance right) - { - return new ThermalResistance(-right.Value, right.Unit); - } - - public static ThermalResistance operator +(ThermalResistance left, ThermalResistance right) - { - return new ThermalResistance(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ThermalResistance operator -(ThermalResistance left, ThermalResistance right) - { - return new ThermalResistance(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static ThermalResistance operator *(double left, ThermalResistance right) - { - return new ThermalResistance(left * right.Value, right.Unit); - } - - public static ThermalResistance operator *(ThermalResistance left, double right) - { - return new ThermalResistance(left.Value * right, left.Unit); - } - - public static ThermalResistance operator /(ThermalResistance left, double right) - { - return new ThermalResistance(left.Value / right, left.Unit); - } - - public static double operator /(ThermalResistance left, ThermalResistance right) - { - return left.SquareMeterKelvinsPerKilowatt / right.SquareMeterKelvinsPerKilowatt; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -471,43 +332,6 @@ int CompareTo(ThermalResistance other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(ThermalResistance left, ThermalResistance right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(ThermalResistance left, ThermalResistance right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(ThermalResistance left, ThermalResistance right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(ThermalResistance left, ThermalResistance right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(ThermalResistance left, ThermalResistance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(ThermalResistance left, ThermalResistance right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs index 1b39c61651..0d5d4fac2d 100644 --- a/UnitsNet/GeneratedCode/Quantities/Torque.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Torque.g.cs @@ -539,324 +539,6 @@ public static Torque FromTonneForceMillimeters(QuantityValue tonneforcemillimete return new Torque(value, TorqueUnit.TonneForceMillimeter); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Torque from nullable KilogramForceCentimeters. - /// - public static Torque? FromKilogramForceCentimeters(QuantityValue? kilogramforcecentimeters) - { - if (kilogramforcecentimeters.HasValue) - { - return FromKilogramForceCentimeters(kilogramforcecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilogramForceMeters. - /// - public static Torque? FromKilogramForceMeters(QuantityValue? kilogramforcemeters) - { - if (kilogramforcemeters.HasValue) - { - return FromKilogramForceMeters(kilogramforcemeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilogramForceMillimeters. - /// - public static Torque? FromKilogramForceMillimeters(QuantityValue? kilogramforcemillimeters) - { - if (kilogramforcemillimeters.HasValue) - { - return FromKilogramForceMillimeters(kilogramforcemillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilonewtonCentimeters. - /// - public static Torque? FromKilonewtonCentimeters(QuantityValue? kilonewtoncentimeters) - { - if (kilonewtoncentimeters.HasValue) - { - return FromKilonewtonCentimeters(kilonewtoncentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilonewtonMeters. - /// - public static Torque? FromKilonewtonMeters(QuantityValue? kilonewtonmeters) - { - if (kilonewtonmeters.HasValue) - { - return FromKilonewtonMeters(kilonewtonmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilonewtonMillimeters. - /// - public static Torque? FromKilonewtonMillimeters(QuantityValue? kilonewtonmillimeters) - { - if (kilonewtonmillimeters.HasValue) - { - return FromKilonewtonMillimeters(kilonewtonmillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilopoundForceFeet. - /// - public static Torque? FromKilopoundForceFeet(QuantityValue? kilopoundforcefeet) - { - if (kilopoundforcefeet.HasValue) - { - return FromKilopoundForceFeet(kilopoundforcefeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable KilopoundForceInches. - /// - public static Torque? FromKilopoundForceInches(QuantityValue? kilopoundforceinches) - { - if (kilopoundforceinches.HasValue) - { - return FromKilopoundForceInches(kilopoundforceinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable MeganewtonCentimeters. - /// - public static Torque? FromMeganewtonCentimeters(QuantityValue? meganewtoncentimeters) - { - if (meganewtoncentimeters.HasValue) - { - return FromMeganewtonCentimeters(meganewtoncentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable MeganewtonMeters. - /// - public static Torque? FromMeganewtonMeters(QuantityValue? meganewtonmeters) - { - if (meganewtonmeters.HasValue) - { - return FromMeganewtonMeters(meganewtonmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable MeganewtonMillimeters. - /// - public static Torque? FromMeganewtonMillimeters(QuantityValue? meganewtonmillimeters) - { - if (meganewtonmillimeters.HasValue) - { - return FromMeganewtonMillimeters(meganewtonmillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable MegapoundForceFeet. - /// - public static Torque? FromMegapoundForceFeet(QuantityValue? megapoundforcefeet) - { - if (megapoundforcefeet.HasValue) - { - return FromMegapoundForceFeet(megapoundforcefeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable MegapoundForceInches. - /// - public static Torque? FromMegapoundForceInches(QuantityValue? megapoundforceinches) - { - if (megapoundforceinches.HasValue) - { - return FromMegapoundForceInches(megapoundforceinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable NewtonCentimeters. - /// - public static Torque? FromNewtonCentimeters(QuantityValue? newtoncentimeters) - { - if (newtoncentimeters.HasValue) - { - return FromNewtonCentimeters(newtoncentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable NewtonMeters. - /// - public static Torque? FromNewtonMeters(QuantityValue? newtonmeters) - { - if (newtonmeters.HasValue) - { - return FromNewtonMeters(newtonmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable NewtonMillimeters. - /// - public static Torque? FromNewtonMillimeters(QuantityValue? newtonmillimeters) - { - if (newtonmillimeters.HasValue) - { - return FromNewtonMillimeters(newtonmillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable PoundForceFeet. - /// - public static Torque? FromPoundForceFeet(QuantityValue? poundforcefeet) - { - if (poundforcefeet.HasValue) - { - return FromPoundForceFeet(poundforcefeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable PoundForceInches. - /// - public static Torque? FromPoundForceInches(QuantityValue? poundforceinches) - { - if (poundforceinches.HasValue) - { - return FromPoundForceInches(poundforceinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable TonneForceCentimeters. - /// - public static Torque? FromTonneForceCentimeters(QuantityValue? tonneforcecentimeters) - { - if (tonneforcecentimeters.HasValue) - { - return FromTonneForceCentimeters(tonneforcecentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable TonneForceMeters. - /// - public static Torque? FromTonneForceMeters(QuantityValue? tonneforcemeters) - { - if (tonneforcemeters.HasValue) - { - return FromTonneForceMeters(tonneforcemeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Torque from nullable TonneForceMillimeters. - /// - public static Torque? FromTonneForceMillimeters(QuantityValue? tonneforcemillimeters) - { - if (tonneforcemillimeters.HasValue) - { - return FromTonneForceMillimeters(tonneforcemillimeters.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -875,25 +557,6 @@ public static Torque From(QuantityValue value, TorqueUnit fromUnit) return new Torque((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Torque unit value. - public static Torque? From(QuantityValue? value, TorqueUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Torque((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -936,48 +599,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Torque operator -(Torque right) - { - return new Torque(-right.Value, right.Unit); - } - - public static Torque operator +(Torque left, Torque right) - { - return new Torque(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Torque operator -(Torque left, Torque right) - { - return new Torque(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Torque operator *(double left, Torque right) - { - return new Torque(left * right.Value, right.Unit); - } - - public static Torque operator *(Torque left, double right) - { - return new Torque(left.Value * right, left.Unit); - } - - public static Torque operator /(Torque left, double right) - { - return new Torque(left.Value / right, left.Unit); - } - - public static double operator /(Torque left, Torque right) - { - return left.NewtonMeters / right.NewtonMeters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -999,43 +620,6 @@ int CompareTo(Torque other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Torque left, Torque right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Torque left, Torque right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Torque left, Torque right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Torque left, Torque right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Torque left, Torque right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Torque left, Torque right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs index 3fa2401a5d..a79634a8f3 100644 --- a/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VitaminA.g.cs @@ -169,24 +169,6 @@ public static VitaminA FromInternationalUnits(QuantityValue internationalunits) return new VitaminA(value, VitaminAUnit.InternationalUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable VitaminA from nullable InternationalUnits. - /// - public static VitaminA? FromInternationalUnits(QuantityValue? internationalunits) - { - if (internationalunits.HasValue) - { - return FromInternationalUnits(internationalunits.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -205,25 +187,6 @@ public static VitaminA From(QuantityValue value, VitaminAUnit fromUnit) return new VitaminA((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// VitaminA unit value. - public static VitaminA? From(QuantityValue? value, VitaminAUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new VitaminA((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -266,48 +229,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static VitaminA operator -(VitaminA right) - { - return new VitaminA(-right.Value, right.Unit); - } - - public static VitaminA operator +(VitaminA left, VitaminA right) - { - return new VitaminA(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static VitaminA operator -(VitaminA left, VitaminA right) - { - return new VitaminA(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static VitaminA operator *(double left, VitaminA right) - { - return new VitaminA(left * right.Value, right.Unit); - } - - public static VitaminA operator *(VitaminA left, double right) - { - return new VitaminA(left.Value * right, left.Unit); - } - - public static VitaminA operator /(VitaminA left, double right) - { - return new VitaminA(left.Value / right, left.Unit); - } - - public static double operator /(VitaminA left, VitaminA right) - { - return left.InternationalUnits / right.InternationalUnits; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -329,43 +250,6 @@ int CompareTo(VitaminA other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(VitaminA left, VitaminA right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(VitaminA left, VitaminA right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(VitaminA left, VitaminA right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(VitaminA left, VitaminA right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(VitaminA left, VitaminA right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(VitaminA left, VitaminA right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs index 6738fda05d..5f02694569 100644 --- a/UnitsNet/GeneratedCode/Quantities/Volume.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/Volume.g.cs @@ -955,669 +955,6 @@ public static Volume FromUsTeaspoons(QuantityValue usteaspoons) return new Volume(value, VolumeUnit.UsTeaspoon); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable Volume from nullable AuTablespoons. - /// - public static Volume? FromAuTablespoons(QuantityValue? autablespoons) - { - if (autablespoons.HasValue) - { - return FromAuTablespoons(autablespoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Centiliters. - /// - public static Volume? FromCentiliters(QuantityValue? centiliters) - { - if (centiliters.HasValue) - { - return FromCentiliters(centiliters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicCentimeters. - /// - public static Volume? FromCubicCentimeters(QuantityValue? cubiccentimeters) - { - if (cubiccentimeters.HasValue) - { - return FromCubicCentimeters(cubiccentimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicDecimeters. - /// - public static Volume? FromCubicDecimeters(QuantityValue? cubicdecimeters) - { - if (cubicdecimeters.HasValue) - { - return FromCubicDecimeters(cubicdecimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicFeet. - /// - public static Volume? FromCubicFeet(QuantityValue? cubicfeet) - { - if (cubicfeet.HasValue) - { - return FromCubicFeet(cubicfeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicInches. - /// - public static Volume? FromCubicInches(QuantityValue? cubicinches) - { - if (cubicinches.HasValue) - { - return FromCubicInches(cubicinches.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicKilometers. - /// - public static Volume? FromCubicKilometers(QuantityValue? cubickilometers) - { - if (cubickilometers.HasValue) - { - return FromCubicKilometers(cubickilometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicMeters. - /// - public static Volume? FromCubicMeters(QuantityValue? cubicmeters) - { - if (cubicmeters.HasValue) - { - return FromCubicMeters(cubicmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicMicrometers. - /// - public static Volume? FromCubicMicrometers(QuantityValue? cubicmicrometers) - { - if (cubicmicrometers.HasValue) - { - return FromCubicMicrometers(cubicmicrometers.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicMiles. - /// - public static Volume? FromCubicMiles(QuantityValue? cubicmiles) - { - if (cubicmiles.HasValue) - { - return FromCubicMiles(cubicmiles.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicMillimeters. - /// - public static Volume? FromCubicMillimeters(QuantityValue? cubicmillimeters) - { - if (cubicmillimeters.HasValue) - { - return FromCubicMillimeters(cubicmillimeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable CubicYards. - /// - public static Volume? FromCubicYards(QuantityValue? cubicyards) - { - if (cubicyards.HasValue) - { - return FromCubicYards(cubicyards.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Deciliters. - /// - public static Volume? FromDeciliters(QuantityValue? deciliters) - { - if (deciliters.HasValue) - { - return FromDeciliters(deciliters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable HectocubicFeet. - /// - public static Volume? FromHectocubicFeet(QuantityValue? hectocubicfeet) - { - if (hectocubicfeet.HasValue) - { - return FromHectocubicFeet(hectocubicfeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable HectocubicMeters. - /// - public static Volume? FromHectocubicMeters(QuantityValue? hectocubicmeters) - { - if (hectocubicmeters.HasValue) - { - return FromHectocubicMeters(hectocubicmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Hectoliters. - /// - public static Volume? FromHectoliters(QuantityValue? hectoliters) - { - if (hectoliters.HasValue) - { - return FromHectoliters(hectoliters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable ImperialBeerBarrels. - /// - public static Volume? FromImperialBeerBarrels(QuantityValue? imperialbeerbarrels) - { - if (imperialbeerbarrels.HasValue) - { - return FromImperialBeerBarrels(imperialbeerbarrels.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable ImperialGallons. - /// - public static Volume? FromImperialGallons(QuantityValue? imperialgallons) - { - if (imperialgallons.HasValue) - { - return FromImperialGallons(imperialgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable ImperialOunces. - /// - public static Volume? FromImperialOunces(QuantityValue? imperialounces) - { - if (imperialounces.HasValue) - { - return FromImperialOunces(imperialounces.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable KilocubicFeet. - /// - public static Volume? FromKilocubicFeet(QuantityValue? kilocubicfeet) - { - if (kilocubicfeet.HasValue) - { - return FromKilocubicFeet(kilocubicfeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable KilocubicMeters. - /// - public static Volume? FromKilocubicMeters(QuantityValue? kilocubicmeters) - { - if (kilocubicmeters.HasValue) - { - return FromKilocubicMeters(kilocubicmeters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable KiloimperialGallons. - /// - public static Volume? FromKiloimperialGallons(QuantityValue? kiloimperialgallons) - { - if (kiloimperialgallons.HasValue) - { - return FromKiloimperialGallons(kiloimperialgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable KilousGallons. - /// - public static Volume? FromKilousGallons(QuantityValue? kilousgallons) - { - if (kilousgallons.HasValue) - { - return FromKilousGallons(kilousgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Liters. - /// - public static Volume? FromLiters(QuantityValue? liters) - { - if (liters.HasValue) - { - return FromLiters(liters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable MegacubicFeet. - /// - public static Volume? FromMegacubicFeet(QuantityValue? megacubicfeet) - { - if (megacubicfeet.HasValue) - { - return FromMegacubicFeet(megacubicfeet.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable MegaimperialGallons. - /// - public static Volume? FromMegaimperialGallons(QuantityValue? megaimperialgallons) - { - if (megaimperialgallons.HasValue) - { - return FromMegaimperialGallons(megaimperialgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable MegausGallons. - /// - public static Volume? FromMegausGallons(QuantityValue? megausgallons) - { - if (megausgallons.HasValue) - { - return FromMegausGallons(megausgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable MetricCups. - /// - public static Volume? FromMetricCups(QuantityValue? metriccups) - { - if (metriccups.HasValue) - { - return FromMetricCups(metriccups.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable MetricTeaspoons. - /// - public static Volume? FromMetricTeaspoons(QuantityValue? metricteaspoons) - { - if (metricteaspoons.HasValue) - { - return FromMetricTeaspoons(metricteaspoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Microliters. - /// - public static Volume? FromMicroliters(QuantityValue? microliters) - { - if (microliters.HasValue) - { - return FromMicroliters(microliters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Milliliters. - /// - public static Volume? FromMilliliters(QuantityValue? milliliters) - { - if (milliliters.HasValue) - { - return FromMilliliters(milliliters.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable OilBarrels. - /// - public static Volume? FromOilBarrels(QuantityValue? oilbarrels) - { - if (oilbarrels.HasValue) - { - return FromOilBarrels(oilbarrels.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Tablespoons. - /// - public static Volume? FromTablespoons(QuantityValue? tablespoons) - { - if (tablespoons.HasValue) - { - return FromTablespoons(tablespoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable Teaspoons. - /// - public static Volume? FromTeaspoons(QuantityValue? teaspoons) - { - if (teaspoons.HasValue) - { - return FromTeaspoons(teaspoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UkTablespoons. - /// - public static Volume? FromUkTablespoons(QuantityValue? uktablespoons) - { - if (uktablespoons.HasValue) - { - return FromUkTablespoons(uktablespoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsBeerBarrels. - /// - public static Volume? FromUsBeerBarrels(QuantityValue? usbeerbarrels) - { - if (usbeerbarrels.HasValue) - { - return FromUsBeerBarrels(usbeerbarrels.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsCustomaryCups. - /// - public static Volume? FromUsCustomaryCups(QuantityValue? uscustomarycups) - { - if (uscustomarycups.HasValue) - { - return FromUsCustomaryCups(uscustomarycups.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsGallons. - /// - public static Volume? FromUsGallons(QuantityValue? usgallons) - { - if (usgallons.HasValue) - { - return FromUsGallons(usgallons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsLegalCups. - /// - public static Volume? FromUsLegalCups(QuantityValue? uslegalcups) - { - if (uslegalcups.HasValue) - { - return FromUsLegalCups(uslegalcups.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsOunces. - /// - public static Volume? FromUsOunces(QuantityValue? usounces) - { - if (usounces.HasValue) - { - return FromUsOunces(usounces.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsPints. - /// - public static Volume? FromUsPints(QuantityValue? uspints) - { - if (uspints.HasValue) - { - return FromUsPints(uspints.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsQuarts. - /// - public static Volume? FromUsQuarts(QuantityValue? usquarts) - { - if (usquarts.HasValue) - { - return FromUsQuarts(usquarts.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsTablespoons. - /// - public static Volume? FromUsTablespoons(QuantityValue? ustablespoons) - { - if (ustablespoons.HasValue) - { - return FromUsTablespoons(ustablespoons.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable Volume from nullable UsTeaspoons. - /// - public static Volume? FromUsTeaspoons(QuantityValue? usteaspoons) - { - if (usteaspoons.HasValue) - { - return FromUsTeaspoons(usteaspoons.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -1636,25 +973,6 @@ public static Volume From(QuantityValue value, VolumeUnit fromUnit) return new Volume((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// Volume unit value. - public static Volume? From(QuantityValue? value, VolumeUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new Volume((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1697,48 +1015,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static Volume operator -(Volume right) - { - return new Volume(-right.Value, right.Unit); - } - - public static Volume operator +(Volume left, Volume right) - { - return new Volume(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Volume operator -(Volume left, Volume right) - { - return new Volume(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static Volume operator *(double left, Volume right) - { - return new Volume(left * right.Value, right.Unit); - } - - public static Volume operator *(Volume left, double right) - { - return new Volume(left.Value * right, left.Unit); - } - - public static Volume operator /(Volume left, double right) - { - return new Volume(left.Value / right, left.Unit); - } - - public static double operator /(Volume left, Volume right) - { - return left.CubicMeters / right.CubicMeters; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1760,43 +1036,6 @@ int CompareTo(Volume other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(Volume left, Volume right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(Volume left, Volume right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(Volume left, Volume right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(Volume left, Volume right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(Volume left, Volume right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(Volume left, Volume right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs index 2fa2823e56..d83477e5a7 100644 --- a/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs +++ b/UnitsNet/GeneratedCode/Quantities/VolumeFlow.g.cs @@ -593,369 +593,6 @@ public static VolumeFlow FromUsGallonsPerSecond(QuantityValue usgallonspersecond return new VolumeFlow(value, VolumeFlowUnit.UsGallonsPerSecond); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Get nullable VolumeFlow from nullable CentilitersPerMinute. - /// - public static VolumeFlow? FromCentilitersPerMinute(QuantityValue? centilitersperminute) - { - if (centilitersperminute.HasValue) - { - return FromCentilitersPerMinute(centilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicDecimetersPerMinute. - /// - public static VolumeFlow? FromCubicDecimetersPerMinute(QuantityValue? cubicdecimetersperminute) - { - if (cubicdecimetersperminute.HasValue) - { - return FromCubicDecimetersPerMinute(cubicdecimetersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerHour. - /// - public static VolumeFlow? FromCubicFeetPerHour(QuantityValue? cubicfeetperhour) - { - if (cubicfeetperhour.HasValue) - { - return FromCubicFeetPerHour(cubicfeetperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerMinute. - /// - public static VolumeFlow? FromCubicFeetPerMinute(QuantityValue? cubicfeetperminute) - { - if (cubicfeetperminute.HasValue) - { - return FromCubicFeetPerMinute(cubicfeetperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicFeetPerSecond. - /// - public static VolumeFlow? FromCubicFeetPerSecond(QuantityValue? cubicfeetpersecond) - { - if (cubicfeetpersecond.HasValue) - { - return FromCubicFeetPerSecond(cubicfeetpersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerHour. - /// - public static VolumeFlow? FromCubicMetersPerHour(QuantityValue? cubicmetersperhour) - { - if (cubicmetersperhour.HasValue) - { - return FromCubicMetersPerHour(cubicmetersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerMinute. - /// - public static VolumeFlow? FromCubicMetersPerMinute(QuantityValue? cubicmetersperminute) - { - if (cubicmetersperminute.HasValue) - { - return FromCubicMetersPerMinute(cubicmetersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicMetersPerSecond. - /// - public static VolumeFlow? FromCubicMetersPerSecond(QuantityValue? cubicmeterspersecond) - { - if (cubicmeterspersecond.HasValue) - { - return FromCubicMetersPerSecond(cubicmeterspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerHour. - /// - public static VolumeFlow? FromCubicYardsPerHour(QuantityValue? cubicyardsperhour) - { - if (cubicyardsperhour.HasValue) - { - return FromCubicYardsPerHour(cubicyardsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerMinute. - /// - public static VolumeFlow? FromCubicYardsPerMinute(QuantityValue? cubicyardsperminute) - { - if (cubicyardsperminute.HasValue) - { - return FromCubicYardsPerMinute(cubicyardsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable CubicYardsPerSecond. - /// - public static VolumeFlow? FromCubicYardsPerSecond(QuantityValue? cubicyardspersecond) - { - if (cubicyardspersecond.HasValue) - { - return FromCubicYardsPerSecond(cubicyardspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable DecilitersPerMinute. - /// - public static VolumeFlow? FromDecilitersPerMinute(QuantityValue? decilitersperminute) - { - if (decilitersperminute.HasValue) - { - return FromDecilitersPerMinute(decilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable KilolitersPerMinute. - /// - public static VolumeFlow? FromKilolitersPerMinute(QuantityValue? kilolitersperminute) - { - if (kilolitersperminute.HasValue) - { - return FromKilolitersPerMinute(kilolitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerHour. - /// - public static VolumeFlow? FromLitersPerHour(QuantityValue? litersperhour) - { - if (litersperhour.HasValue) - { - return FromLitersPerHour(litersperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerMinute. - /// - public static VolumeFlow? FromLitersPerMinute(QuantityValue? litersperminute) - { - if (litersperminute.HasValue) - { - return FromLitersPerMinute(litersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable LitersPerSecond. - /// - public static VolumeFlow? FromLitersPerSecond(QuantityValue? literspersecond) - { - if (literspersecond.HasValue) - { - return FromLitersPerSecond(literspersecond.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable MicrolitersPerMinute. - /// - public static VolumeFlow? FromMicrolitersPerMinute(QuantityValue? microlitersperminute) - { - if (microlitersperminute.HasValue) - { - return FromMicrolitersPerMinute(microlitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable MillilitersPerMinute. - /// - public static VolumeFlow? FromMillilitersPerMinute(QuantityValue? millilitersperminute) - { - if (millilitersperminute.HasValue) - { - return FromMillilitersPerMinute(millilitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable MillionUsGallonsPerDay. - /// - public static VolumeFlow? FromMillionUsGallonsPerDay(QuantityValue? millionusgallonsperday) - { - if (millionusgallonsperday.HasValue) - { - return FromMillionUsGallonsPerDay(millionusgallonsperday.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable NanolitersPerMinute. - /// - public static VolumeFlow? FromNanolitersPerMinute(QuantityValue? nanolitersperminute) - { - if (nanolitersperminute.HasValue) - { - return FromNanolitersPerMinute(nanolitersperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable OilBarrelsPerDay. - /// - public static VolumeFlow? FromOilBarrelsPerDay(QuantityValue? oilbarrelsperday) - { - if (oilbarrelsperday.HasValue) - { - return FromOilBarrelsPerDay(oilbarrelsperday.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerHour. - /// - public static VolumeFlow? FromUsGallonsPerHour(QuantityValue? usgallonsperhour) - { - if (usgallonsperhour.HasValue) - { - return FromUsGallonsPerHour(usgallonsperhour.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerMinute. - /// - public static VolumeFlow? FromUsGallonsPerMinute(QuantityValue? usgallonsperminute) - { - if (usgallonsperminute.HasValue) - { - return FromUsGallonsPerMinute(usgallonsperminute.Value); - } - else - { - return null; - } - } - - /// - /// Get nullable VolumeFlow from nullable UsGallonsPerSecond. - /// - public static VolumeFlow? FromUsGallonsPerSecond(QuantityValue? usgallonspersecond) - { - if (usgallonspersecond.HasValue) - { - return FromUsGallonsPerSecond(usgallonspersecond.Value); - } - else - { - return null; - } - } - -#endif /// /// Dynamically convert from value and unit enum to . @@ -974,25 +611,6 @@ public static VolumeFlow From(QuantityValue value, VolumeFlowUnit fromUnit) return new VolumeFlow((double)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// VolumeFlow unit value. - public static VolumeFlow? From(QuantityValue? value, VolumeFlowUnit fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new VolumeFlow((double)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -1035,48 +653,6 @@ public static string GetAbbreviation( #endregion - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static VolumeFlow operator -(VolumeFlow right) - { - return new VolumeFlow(-right.Value, right.Unit); - } - - public static VolumeFlow operator +(VolumeFlow left, VolumeFlow right) - { - return new VolumeFlow(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static VolumeFlow operator -(VolumeFlow left, VolumeFlow right) - { - return new VolumeFlow(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static VolumeFlow operator *(double left, VolumeFlow right) - { - return new VolumeFlow(left * right.Value, right.Unit); - } - - public static VolumeFlow operator *(VolumeFlow left, double right) - { - return new VolumeFlow(left.Value * right, left.Unit); - } - - public static VolumeFlow operator /(VolumeFlow left, double right) - { - return new VolumeFlow(left.Value / right, left.Unit); - } - - public static double operator /(VolumeFlow left, VolumeFlow right) - { - return left.CubicMetersPerSecond / right.CubicMetersPerSecond; - } -#endif - - #endregion - #region Equality / IComparable public int CompareTo(object obj) @@ -1098,43 +674,6 @@ int CompareTo(VolumeFlow other) return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=(VolumeFlow left, VolumeFlow right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=(VolumeFlow left, VolumeFlow right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <(VolumeFlow left, VolumeFlow right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >(VolumeFlow left, VolumeFlow right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator ==(VolumeFlow left, VolumeFlow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] - public static bool operator !=(VolumeFlow left, VolumeFlow right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - [Obsolete("It is not safe to compare equality due to using System.Double as the internal representation. It is very easy to get slightly different values due to floating point operations. Instead use Equals($quantityName, double, ComparisonType) to provide the max allowed absolute or relative error.")] public override bool Equals(object obj) { diff --git a/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 b/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 index 410eed33ae..ba7a62c49f 100644 --- a/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 +++ b/UnitsNet/Scripts/Include-GenerateLogarithmicCode.ps1 @@ -1,4 +1,4 @@ -<# +<# .SYNOPSIS Generates the C# source code for logarithmic arithmetic operators. @@ -24,8 +24,6 @@ function GenerateLogarithmicArithmeticOperators([string]$quantityName, [string]$ #region Logarithmic Arithmetic Operators - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP public static $quantityName operator -($quantityName right) { return new $quantityName(-right.Value, right.Unit); @@ -68,7 +66,6 @@ function GenerateLogarithmicArithmeticOperators([string]$quantityName, [string]$ // Logarithmic division = subtraction return Convert.ToDouble(left.Value - right.AsBaseNumericType(left.Unit)); } -#endif #endregion "@; diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 index 51b37cdd41..27b6440f15 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeCommon.ps1 @@ -240,27 +240,6 @@ namespace UnitsNet } "@; }@" - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP -"@; foreach ($unit in $units) { - $valueParamName = $unit.PluralName.ToLowerInvariant();@" - /// - /// Get nullable $quantityName from nullable $($unit.PluralName). - /// - public static $($quantityName)? From$($unit.PluralName)($($quantityValueType)? $valueParamName) - { - if ($($valueParamName).HasValue) - { - return From$($unit.PluralName)($($valueParamName).Value); - } - else - { - return null; - } - } - -"@; }@" -#endif /// /// Dynamically convert from value and unit enum to . @@ -279,25 +258,6 @@ namespace UnitsNet return new $quantityName(($baseType)value, fromUnit); } - // Windows Runtime Component does not support nullable types (double?): https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - /// - /// Dynamically convert from value and unit enum to . - /// - /// Value to convert from. - /// Unit to convert from. - /// $quantityName unit value. - public static $($quantityName)? From($($quantityValueType)? value, $unitEnumName fromUnit) - { - if (!value.HasValue) - { - return null; - } - - return new $quantityName(($baseType)value.Value, fromUnit); - } -#endif - /// /// Get unit abbreviation string. /// @@ -339,54 +299,6 @@ namespace UnitsNet } #endregion -"@; if ($quantity.Logarithmic -eq $true) { - # Call another script function to generate logarithm-specific arithmetic operator code. - GenerateLogarithmicArithmeticOperators -quantityName $quantityName -baseUnitFieldName $baseUnitFieldName -baseType $baseType -scalingFactor $quantity.LogarithmicScalingFactor - } - elseif ($quantity.GenerateArithmetic -eq $true) {@" - - #region Arithmetic Operators - - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static $quantityName operator -($quantityName right) - { - return new $quantityName(-right.Value, right.Unit); - } - - public static $quantityName operator +($quantityName left, $quantityName right) - { - return new $quantityName(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static $quantityName operator -($quantityName left, $quantityName right) - { - return new $quantityName(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); - } - - public static $quantityName operator *($baseType left, $quantityName right) - { - return new $quantityName(left * right.Value, right.Unit); - } - - public static $quantityName operator *($quantityName left, $baseType right) - { - return new $quantityName(left.Value * right, left.Unit); - } - - public static $quantityName operator /($quantityName left, $baseType right) - { - return new $quantityName(left.Value / right, left.Unit); - } - - public static double operator /($quantityName left, $quantityName right) - { - return left.$baseUnitPluralName / right.$baseUnitPluralName; - } -#endif - - #endregion -"@; }@" #region Equality / IComparable @@ -409,41 +321,6 @@ namespace UnitsNet return _value.CompareTo(other.AsBaseNumericType(this.Unit)); } - // Windows Runtime Component does not allow operator overloads: https://msdn.microsoft.com/en-us/library/br230301.aspx -#if !WINDOWS_UWP - public static bool operator <=($quantityName left, $quantityName right) - { - return left.Value <= right.AsBaseNumericType(left.Unit); - } - - public static bool operator >=($quantityName left, $quantityName right) - { - return left.Value >= right.AsBaseNumericType(left.Unit); - } - - public static bool operator <($quantityName left, $quantityName right) - { - return left.Value < right.AsBaseNumericType(left.Unit); - } - - public static bool operator >($quantityName left, $quantityName right) - { - return left.Value > right.AsBaseNumericType(left.Unit); - } - - $($obsoleteEqualityIfDouble)public static bool operator ==($quantityName left, $quantityName right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value == right.AsBaseNumericType(left.Unit); - } - - $($obsoleteEqualityIfDouble)public static bool operator !=($quantityName left, $quantityName right) - { - // ReSharper disable once CompareOfFloatsByEqualityOperator - return left.Value != right.AsBaseNumericType(left.Unit); - } -#endif - $($obsoleteEqualityIfDouble)public override bool Equals(object obj) { if(obj is null || !(obj is $quantityName)) diff --git a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 index cd7fc63fce..6c1468abbf 100644 --- a/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 +++ b/UnitsNet/Scripts/Include-GenerateQuantitySourceCodeNetFramework.ps1 @@ -100,6 +100,110 @@ namespace UnitsNet /// The numeric value this quantity was constructed with. /// public $baseType Value => _value; + + #region Nullable From Methods + +"@; foreach ($unit in $units) { + $valueParamName = $unit.PluralName.ToLowerInvariant();@" + /// + /// Get nullable $quantityName from nullable $($unit.PluralName). + /// + public static $($quantityName)? From$($unit.PluralName)($($quantityValueType)? $valueParamName) + { + return $($valueParamName).HasValue ? From$($unit.PluralName)($($valueParamName).Value) : default($($quantityName)?); + } + +"@; }@" + /// + /// Dynamically convert from value and unit enum to . + /// + /// Value to convert from. + /// Unit to convert from. + /// $quantityName unit value. + public static $($quantityName)? From($($quantityValueType)? value, $unitEnumName fromUnit) + { + return value.HasValue ? new $quantityName(($baseType)value.Value, fromUnit) : default($($quantityName)?); + } + + #endregion +"@; + if ($quantity.Logarithmic -eq $true) { + # Call another script function to generate logarithm-specific arithmetic operator code. + GenerateLogarithmicArithmeticOperators -quantityName $quantityName -baseUnitFieldName $baseUnitFieldName -baseType $baseType -scalingFactor $quantity.LogarithmicScalingFactor + } + elseif ($quantity.GenerateArithmetic -eq $true) {@" + + #region Arithmetic Operators + + public static $quantityName operator -($quantityName right) + { + return new $quantityName(-right.Value, right.Unit); + } + + public static $quantityName operator +($quantityName left, $quantityName right) + { + return new $quantityName(left.Value + right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static $quantityName operator -($quantityName left, $quantityName right) + { + return new $quantityName(left.Value - right.AsBaseNumericType(left.Unit), left.Unit); + } + + public static $quantityName operator *($baseType left, $quantityName right) + { + return new $quantityName(left * right.Value, right.Unit); + } + + public static $quantityName operator *($quantityName left, $baseType right) + { + return new $quantityName(left.Value * right, left.Unit); + } + + public static $quantityName operator /($quantityName left, $baseType right) + { + return new $quantityName(left.Value / right, left.Unit); + } + + public static double operator /($quantityName left, $quantityName right) + { + return left.$baseUnitPluralName / right.$baseUnitPluralName; + } + + #endregion +"@; }@" + + public static bool operator <=($quantityName left, $quantityName right) + { + return left.Value <= right.AsBaseNumericType(left.Unit); + } + + public static bool operator >=($quantityName left, $quantityName right) + { + return left.Value >= right.AsBaseNumericType(left.Unit); + } + + public static bool operator <($quantityName left, $quantityName right) + { + return left.Value < right.AsBaseNumericType(left.Unit); + } + + public static bool operator >($quantityName left, $quantityName right) + { + return left.Value > right.AsBaseNumericType(left.Unit); + } + + $($obsoleteEqualityIfDouble)public static bool operator ==($quantityName left, $quantityName right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value == right.AsBaseNumericType(left.Unit); + } + + $($obsoleteEqualityIfDouble)public static bool operator !=($quantityName left, $quantityName right) + { + // ReSharper disable once CompareOfFloatsByEqualityOperator + return left.Value != right.AsBaseNumericType(left.Unit); + } } } "@;